Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why this code is not executing?
Message
Information générale
Forum:
ASP.NET
Catégorie:
MVC
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01555962
Message ID:
01555981
Vues:
24
>>
>>Can you please show a sample of the client side redirect? Also, how will it get the model I am passing?
>
>I tend to just use something like this:
>
>
>document.location = "urlgoeshere";
>
>
>You don't really pass the model directly. What I do is embed the primary key in a hidden column of the grid. When the grid loads, I check the record count. If it's 1 I grab this hidden column and include it in my redirect.
>
>Here's some code from one of my projects. I'm using jqGrid so you won't be able to use it as-is, but hopefully it helps point you in the right direction:
>
>Basically what happens is the grid requests data via JSON (not shown). Once it has retrieved that data it calls gridLoadComplete and passes in the data it received. I select the first row. Another jqGrid event fires when the row is selected that calls selectLoan and it passes in the primary key I set in gridLoadComplete. I have a settings object that holds my settings and URLs so I take that URL and add in the ID (so the URL ends up being something like /Controller/Action/Edit/1)
>
>Most of this code is just eventing stuff specific to jqGrid.
>
>
>   var settings = {
>      viewLoanUrl: "@Url.Content("~/Loan/Detail/")";
>   };
>
>    function selectLoan(id, selected) {
>        document.location = settings.viewLoanUrl + id;
>    }
>
>    function gridLoadComplete(data) {
>        if (data.records == "1") {
>            var items = $("#loan").jqGrid("getRowData");
>            $("#loan").jqGrid("setSelection", items[0].Loan);            
>        }
>    }
>
I may try something like that also, although this is still hard for me. I've been able to achieve partial success with flexigrid. Partial, because I have now the following problem - I only want a few columns in the grid, but I want to see all columns in the add/edit. I didn't find a lot of examples. One example I used initially is too simple and another one is too complex for me (besides, it is still not what I need anyway).

That's the complex stuff I found http://www.ienablemuch.com/2011/11/flexigrid-crudinline-form-with-aspnet.html

On Friday Dorin pointed me to http://www.datatables.net/examples/ and this seems like a great and simplest (minimal coding required) way to get the nice grid, so I plan to try it also. I got caught up in a different issue while I was thinking of switching - how to properly add them to the project (using CDN). This led me to a different blog about bundles config which in turn presented a new problem of not being able to simply provide a CDN directory for all jquery files.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform