ASPXGridView Custom CallBack

We have a DevExpress grid and in the OnCustomCallback event we need to assign the value of the hidden field = true. After we need to get the value of a hidden field in javascript? We tried as follows:

protected void dgUnReconcile_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
{
    ASPxGridView temp = ((DevExpress.Web.ASPxGridView.ASPxGridView)(sender));
    string gridInstancename = ((DevExpress.Web.ASPxGridView.ASPxGridView)(sender)).ClientInstanceName;

    if (gridInstancename.Equals("grid"))
    {
        List<Object> selected = dgUnReconcile.GetSelectedFieldValues(new[] { "Key" });
        if (selected.Count > 0)
        {    
                existingKey = true;//hidden field value
        }
    }
}

      

We need to access the value of the hidden fields via javascript

var = '<% # existingKey%>';

It always shows blank.

+2


source to share


2 answers


Try using the JSProperties of the grid:

ASPX:

<dxwgv:ASPxGridView ID="myGridView" ClientInstanceName="myGridView" runat="server">
</dxwgv:ASPxGridView>

      

sets a value in code-behind (C #):



myGridView.JSProperties["cpMyValue"] = "hello, world!";

      

gets the value on the client (js):

alert(myGridView.cpMyValue);

      

+2


source


To change other controls during a server-side event, you may need to disable callbacks (see the ASPxGridView.EnableCallBacks property) and put both the hidden field and the grid control in the UpdatePanel.

Alternatively, you can do it client side with javascript if you want the callbacks to be included. Here's an example of a similar example:



http://www.devexpress.com/Support/Center/p/Q201214.aspx

0


source







All Articles