Thursday, April 10, 2014

DevExpress events and how they are wired up

<dx:ASPxGridView ID="Foo" runat="server" KeyFieldName="FooId" Width="1000px"
      DataSourceID="FooFeeder" ClientInstanceName="Foo" Visible="true">
   <ClientSideEvents RowDblClick="Foo_RowDblClick" ></ClientSideEvents>

 
 

The event above, for the double-clicking of a row in a DevExpress grid as setup at a web form's markup, may be instead set up on the C# side like so:

Foo.ClientSideEvents.RowDblClick = "Foo_RowDblClick";

 
 

Before the line of code above, you will need a line of code like so to specify which JavaScript file to find a dance partner in.

RegisterSharedJsScript("Whatever", "Whatever.js");

 
 

Without the C# implementation, you still need to specify a .js dance partner even if you do things in the .aspx markup. The event will call a JavaScript funtion in the .js file you specify like so:

function Foo_RowDblClick(s, e) {
   doSomething();
}

No comments:

Post a Comment