Search code examples
c#model-view-controllergridviewdevexpress

How to get GridLookup with complex name


I'm trying to get GridLookup selected value,

@Html.DevExpress().GridLookup(settingsGrid =>
{
    settingsGrid.Name = "CommandeDetailEnCours.Compte";
    settingsGrid.KeyFieldName = "Numero";

    [...]
}).BindList(Model.ListeComptes).Bind(Model.CommandeDetailEnCours.Compte).GetHtml()

The question is: How I can get Value because in javascript

"CommandeDetailEnCours.Compte".GetGridView() [...] 

not work ?


Solution

  • Use the client-side GetValue method in the following manner.

    To retrieve the complex name on the client use the How to use the ClientInstanceName and Name properties when they contain special characters approach.

    var lookupClientInstance = ASPxClientControl.GetControlCollection().GetByName("CommandeDetailEnCours.Compte");
    var value = lookupClientInstance.GetValue();
    alert(value);