Jquery Alertify in DevExpress Gridview ClientSidEevents

824 Views Asked by At

I try to use a jquery alert plugin 'alertify' to replace the 'confirm delete' ability in DevExpress GridView. Below is my code, it won't go to ASPxGridView2_CustomButtonCallback. Can someone help to advice?

<dx:ASPxGridView ID="ASPxGridView2" ClientIDMode="Static" runat="server" 
AutoGenerateColumns="False" DataSourceID="sql_source" KeyFieldName="UID"
Width="100%" 
OnCustomButtonCallback="ASPxGridView2_CustomButtonCallback">

<ClientSideEvents CustomButtonClick="function(s, e) {
     alertify.confirm('are you sure?', function (c) {
        if (c) {
            alertify.log('Deleted!');
            e.processOnServer = true;
        } else {
            alertify.log('Cancel!');
        }
     });}
"/>

<Columns>
  <dx:GridViewCommandColumn VisibleIndex="0" Width="120px" ShowInCustomizationForm="True">
      <EditButton Visible="True"></EditButton>
      <CustomButtons>
          <dx:GridViewCommandColumnCustomButton ID="CustDel" Text="MyDel">
          </dx:GridViewCommandColumnCustomButton>
      </CustomButtons>
      <CellStyle HorizontalAlign="Left"></CellStyle>
   </dx:GridViewCommandColumn>
</Columns>
</dx:ASPxGridView>
1

There are 1 best solutions below

1
On

You should set the property EnableCallBacks to "True" for your GridView

<dx:ASPxGridView ID="ASPxGridView2" ClientIDMode="Static" runat="server" 
    AutoGenerateColumns="False" DataSourceID="sql_source" KeyFieldName="UID" Width="100%"
    EnableCallBacks="True" OnCustomButtonCallback="ASPxGridView2_CustomButtonCallback">