Tuesday, November 12, 2013

Update External Control outside of ASPxGridView (DevXPress)

It's impossible to update external control rendering during the ASPxGridView callback.

To send data from Server side callback event to Client side (JS),  you can use the "JSProperty"
 http://www.devexpress.com/Support/Center/Example/Details/E2379

e.g
C#:
    myGridView.JSProperties("cp1")="test value"; 
[JScript]
   EndCallback="function(s, e) {
       if (s.cp1) {
           alert(s.cp1);
           delete s.cp1;
         }
   } 
The other solution to update the external control in the server side event, you need 
disable the callback by setting the EnableCallBack property of the grid to "false" 

ASPX
 <dxwgv:ASPxGridView ID="grView1" runat="server" KeyFieldName="ID"
 OnCustomButtonCallback="grid_CustomButtonCallback"  EnableCallBacks="false" >

C#
 protected void grid_CustomButtonCallback(object sender,
              ASPxGridViewCustomButtonCallbackEventArgs e)
        {
            if (e.ButtonID != "edit") return;
            txt1.text = grView1.GetRowValues(e.VisibleIndex, "ID").ToString();
        }



References:
http://www.devexpress.com/Support/Center/Question/Details/Q405422
http://www.devexpress.com/Support/Center/Question/Details/Q349498

No comments:

Post a Comment