在DevExpress Gridview ClientSidEevents中使用Jquery Alertify

时间:2014-01-29 03:32:09

标签: c# jquery gridview devexpress alertify

我尝试使用jquery警报插件'alertify'来替换DevExpress GridView中的'确认删除'功能。下面是我的代码,它不会转到 ASPxGridView2_CustomButtonCallback 。有人可以提供建议吗?

<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 个答案:

答案 0 :(得分:0)

您应该为GridView

将属性EnableCallBacks设置为“True”
<dx:ASPxGridView ID="ASPxGridView2" ClientIDMode="Static" runat="server" 
    AutoGenerateColumns="False" DataSourceID="sql_source" KeyFieldName="UID" Width="100%"
    EnableCallBacks="True" OnCustomButtonCallback="ASPxGridView2_CustomButtonCallback">