ASPxGridView PerformCallback() does full page post

2019-08-22 03:46发布

问题:

I have a checkbox that when clicked, calls a javascript program that calls grid.PerformCallback(), where grid is the client instance name of my ASPxGridView gridview. This gridview also has a custom callback method which databinds the table. However when i click my checkbox, instead of only performing callback on the gridview, my page does a full postback, which posts the form. How do i make it so that it only updates the gridview?

 function toggle()
    {                         
        productGrid.PerformCallback();
    }//end toggleExch()

<dx:ASPxGridView ClientInstanceName="productGrid" Width="100%" ID="productGrid" runat="server"
                DataSourceID="ProductSQL" EnableCallBacks="true" OnCustomCallback="productGrid_OnCustomCallback">            
        </dx:ASPxGridView>

protected void productGrid_OnCustomCallback(object sender,
                        DevExpress.Web.ASPxGridView.ASPxGridViewCustomCallbackEventArgs e)
{
    System.Diagnostics.Debug.WriteLine("in postback");
    productGrid.DataBind();
}//end productGrid_OnCustomCallback()

so basically the debug line is not printed and the page goes into full postback - how do i only postback and databind the grid? (i need to do more server side processing before databinding or directly binding from jquery is out of the question)

回答1:

found the answer - should use iscallback instead of ispostback



回答2:

Unfortunately, you did not post the aspx markup of the button. However, if this is the ASPxButton, make certain that its AutoPostback property is false ...