• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

looking for alternative to jqGrid in mvc asp.net

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    looking for alternative to jqGrid in mvc asp.net

    has anyone here used this, using json to feed it data, in an mvc environment? i'm debating whether to 'roll my own' or invest some time with it. obvious reservations include the fact that it won't produce an unobtrusive solution. or can it?

    #2
    Aye, I've done it. Using ASP.NET MVC that is.
    How did this happen? Who's to blame? Well certainly there are those more responsible than others, and they will be held accountable, but again truth be told, if you're looking for the guilty, you need only look into a mirror.

    Follow me on Twitter - LinkedIn Profile - The HAB blog - New Blog: Mad Cameron
    Xeno points: +5 - Asperger rating: 36 - Paranoid Schizophrenic rating: 44%

    "We hang the petty thieves and appoint the great ones to high office" - Aesop

    Comment


      #3
      hi hab, i should prob. have included a question with the o/p, beyond the unobtrusive bit, which clearly it can't be

      did you use a cell array or named columns and if the second, did you use iqueryable?

      ta

      Comment


        #4
        First of all, a disclaimer, I’m not a techie; I just hack stuff together until it sort of works.

        I have an async jqGrid on a view and it gets populated by making a call to the controller that returns a JSon result.

        I nicked the code off of somebody’s web page but I can’t find it just now. I’ll have another look later as I think I’ll need to keep a record of this myself.
        How did this happen? Who's to blame? Well certainly there are those more responsible than others, and they will be held accountable, but again truth be told, if you're looking for the guilty, you need only look into a mirror.

        Follow me on Twitter - LinkedIn Profile - The HAB blog - New Blog: Mad Cameron
        Xeno points: +5 - Asperger rating: 36 - Paranoid Schizophrenic rating: 44%

        "We hang the petty thieves and appoint the great ones to high office" - Aesop

        Comment


          #5
          thanks hab. i think i wasn't asking the right question. i get the jquery grid stuff...more or less out the box. what i'm looking for is a solution that is unobtrusive...i think i will need to do it myself.

          i can get the paging working properly, retrieving only the rows i need, but i'm having problems ajaxing it all.

          so far i have in the html:

          ========================
          Code:
          <script language="javascript" type="text/javascript">
              $(document).ready(function() {
                  $("form#paging").submit(function(event) {
                      event.preventDefault();
                  });
              });
          
              function hijack(form, callback) {
                  $("#indicator").show;
          
              }
          </script>
          .
          .
          .
          .

          HTML Code:
          <table>
                  <thead>
                      <tr>
          			    <th>Make</th>
          			    <th>Model</th>
          			    <th>Mileage</th>
          			    <th colspan="3">Action</th>
                      </tr>
                  </thead>
          		<%
          		foreach (Car car in ViewData.Model) { %>
          			<tr>
          				<td><%= car.Make %></td>
          				<td><%= car.Model %></td>
          				<td><%= car.Mileage %></td>
          				<td><%=Html.ActionLink<CarsController>( c => c.Show( car.Id ), "Details ") %></td>
          				<td><%=Html.ActionLink<CarsController>( c => c.Edit( car.Id ), "Edit") %></td>
          				<td>
              				<% using (Html.BeginForm<CarsController>(c => c.Delete(car.Id))) { %>
                                  <%= Html.AntiForgeryToken() %>
              				    <input type="submit" value="Delete" onclick="return confirm('Are you sure?');" />
                              <% } %>
          				</td>
          			</tr>
          		<%} %>
              </table>
          <div class="pager">
          	<% using (Html.BeginForm("Index", "CarsController", FormMethod.Post, new{ID="paging"})) { %>
          		<%= Html.Pager(ViewData.Model.PageSize, ViewData.Model.PageNumber, ViewData.Model.TotalItemCount) %>
          		<% } %>
          	</div>
          =====================

          in the controller:

          ====================================

          Code:
                  
          [Transaction]
                  public ActionResult Index(int? page)
                  {
                      int currentPageIndex = page.HasValue ? page.Value - 1 : 0;
          
                      int numCars = carRepository.GetAll().Count;
                      IList<Car> cars = carRepository.GetAllPaged(currentPageIndex * defaultPageSize, defaultPageSize);
          
                      return View(cars.ToPagedList(currentPageIndex, defaultPageSize, numCars));
                  }
          ====================================

          the ToPagedList method returns all the paging links for the tabular data. i need a way to hook up the click event of each anchor tag of the paging to the js ajax handler...

          ...i realise that the j/script above is incomplete..it's just stubbed out for now.

          ...(wonder if this post will format)

          Comment


            #6
            WTF has that lot got to do with jqGrid ????
            How did this happen? Who's to blame? Well certainly there are those more responsible than others, and they will be held accountable, but again truth be told, if you're looking for the guilty, you need only look into a mirror.

            Follow me on Twitter - LinkedIn Profile - The HAB blog - New Blog: Mad Cameron
            Xeno points: +5 - Asperger rating: 36 - Paranoid Schizophrenic rating: 44%

            "We hang the petty thieves and appoint the great ones to high office" - Aesop

            Comment


              #7
              sorry hab [keep yer hair on]. like i said, i posted the wrong question. i'm really looking for an alternative to the jqgrid, 'coz it don't degrade too nicely when users haven't got j/script enabled [not common i know, but...] and i also want more control over the rendering etc. and i also want to page more than simple tabular data - think asp.net repeater etc...

              so again, apologies, it was my fault for a poorly titled thread and thanks for your help...promise..never do it again...must think more clearly...read before posting...don't mislead...

              Comment

              Working...
              X