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
WebDataGrid and BoundCheckBoxField - ClearDataSource

Infragistics4.Web.v11.1, Version=11.1.20111.2135

I have a problem with WebDataGrid and BoundCheckBoxField (I have also tried the UnBoundCheckBoxField with the same problem).  Below is my grid.  There is a DDL on the page.  When the user changes the DDL, the page posts back to the server and clears the data source, calls to the database, creates a new dataset and binds to the grid.  If the user checks the BoundCheckBoxField but does not save the data, the same checkbox will be checked for the new participant (which is an error).  If I check another document checkbox for the new participant and change the DDL back to the first participant, I will get the error "Requested Record cannot be found by key.".  It does not appear the ClearDataSource really does its job.  Am I doing something wrong?

Code behind:  

  • 29417
    Suggested Answer
    Offline posted

    Hello IntegraSys76 ,


    Thank you for your patience.I’ve managed to reproduce your issue.

    It is due to the fact that the updating event need its original data source. If you make a change to the data in the grid but then during the potsback on load you don’t provide the same data source the updating will fail and will throw the error "Requested Record cannot be found by key” or if it finds a matching record in the new data source it will update it instead. This is the expected behavior for this kind of scenario.


    What you could do to prevent such an issue is to force a postback to commit those changes before you change the data source.

    A possible solution is to handle the  CellValueChanged client side event and in it force the updating with:


            function WebDataGrid1_Editing_CellValueChanged(sender, eventArgs) {          

                ///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param>

                ///<param name="eventArgs" type="Infragistics.Web.UI.CellValueChangedEventArgs"></param>






    In this way everytime you make a change to the data on the client side this will commit the change to server. This will ensure that when you make the postback to change the data source through the DropDownList  the data source will be already updated.


    Please refer to the attached sample and let me know if you have any questions or concerns.


    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

Reply Children
No Data