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:
01555979
Vues:
41
This message has been marked as a message which has helped to the initial question of the thread.
>
>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);            
        }
    }
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform