2014-01-29 87 views
0

我嘗試使用jQuery警報插件'alertify'替換DevExpress GridView中的'confirm delete'功能。下面是我的代碼,它不會去ASPxGridView2_CustomButtonCallback。有人可以幫助建議嗎?DevExpress Gridview ClientSidEevents中的Jquery Alertify

<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> 

回答

0

您應該設置屬性EnableCallBacks以 「真」 爲你的GridView

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

不行!但是,我通過以下步驟解決了我的問題。添加一個javascript函數以使用ajax方法刪除代碼隱藏中的記錄。然後'調用這個javascript函數'來替換'e.processOnServer = true'。 – user1580961