How to make custom buttons in a DevExpress 13.1.9 Grid View do things in JavaScript:
<ClientSideEvents CustomButtonClick="function(s, e) {
if(e.buttonID == 'whatever'){
alert('whatever: ' + e.visibleIndex);
}
}" />
<Columns>
<dx:GridViewCommandColumn Caption="Whatever" ButtonType="Image"
VisibleIndex="1">
<CustomButtons>
<dx:GridViewCommandColumnCustomButton ID="whatever" Text="Whatever">
</dx:GridViewCommandColumnCustomButton>
</CustomButtons>
</dx:GridViewCommandColumn>
</Columns>
s.keys[e.visibleIndex] could be substituted for e.visibleIndex to fish out the key for a row if a KeyFieldName setting was set. It's not the scenario above. Do things on the C# side with a CustomButtonCallback event like so:
private void MyGrid_CustomButtonCallback(object sender,
ASPxGridViewCustomButtonCallbackEventArgs e)
{
if (e.ButtonID == "View")
{
ASPxWebControl.RedirectOnCallback("Whatever.aspx");
}
}
You cannot do a Response.Redirect within a callback, but .RedirectOnCallback is the DevExpress workaround.
No comments:
Post a Comment