Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
580
Unbound CheckBox Column - Async Error while navigate to new Page
posted

Hi,

I am using WebDataGrid in one of my application. I am creating a column dynamically in code behind and it has first 'Unbound CheckBox' column.

While user select some of the checkbox on the first page of the grid and after tries to navigate to another page, 'WebDataGrid' gives an error.

I have attached the sample project and WebEx recording with the exact error I am facing in our application. ('Infragistics_UnboundCheckBox_Error.zip')

Can any one help me to remove the error?

Thanks in advance for helping me.

 

Regards,

Yogesh

Infragistics_UnboundCheckBox_Error.zip
  • 49378
    Verified Answer
    posted

    Hello Yogesh,

    The issue in this case is caused by the fact that WebDataGrid requires data key fields to be set when updating is enabled. This can be done via theDataKeyFieldsproperty. After reviewing your sample further, please note that the grid requires rebinding on each postback (preferable on Page_Load). Rebinding the grid on the page index change event should not be necessary. In addition to that, note that in this scenarioDataBindshould NOT be called in order to avoid the "Requested record cannot be found exception" occurring due to the old records to be updated no longer being available when the grid's CRUD operations take place.

      protected void Page_Load(object sender, EventArgs e)

            {

    if (!Page.IsPostBack)

                    AddColumnsToGrid();

                        if (!Page.IsPostBack)

                {       

    //SetPaging();

                }

                BindData();

                WebDataGrid1.DataKeyFields ="A2";

            }

           private void BindData()

            {       

    DataTable dt = GetData();

                WebDataGrid1.AutoGenerateColumns =false;

                WebDataGrid1.DataSource = dt;

    //WebDataGrid1.DataBind();  

            }

    Hope this helps. Please feel free to contact me if you have any questions.