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
295
ASP.NET UpdatePanel and Timer Interfere with WebGrid
posted

Hi.

I have an interesting issue.  I have an ASP.NET UpdatePanel on the page with a Timer in it that posts back every 15 seconds.  Separately (outside the UpdatePanel), but on the same page, I have an editable UltraWebGrid.  There is also a 'Save' button that allows the user to save all their changes to the records in the UltraWebGrid in one click.  It loops through the rows and checks the DataChanged property to see if it's DataChanged.Modified.  The problem is that if the user is editing several rows in the UltraWebGrid and the Timer causes a postback of the UpdatePanel, the UltraWebGrid seems to "forget" that some of the rows are Modified.

For instance:  The user changes some data in rows 3, 4, and 5.  The Timer causes a postback of the UpdatePanel.  The user changes some data in rows 6 and 7.  The user clicks 'Save'.  Only rows 6 and 7 will be updated because the grid has "forgotten" that the other 3 rows were Modified.

Any advice / suggestions on this issue would be appreciated.  The only thing I can think is to use Javascript to set a Hidden column to 'Modified' and loop through that column when the user clicks 'Save' rather than relying on the DataChanged property of the Row.

 

Parents
  • 335
    posted

    Where do you bind your grid? I think the reason of this issue is grid is getting bind again with the datasource so updates are getting lost.

     If you have InitializeDataSource event then it will be fired for each server trip. It also fired for AJAX calls also.

    In case you are using InitializeDataSource event, you can make databinding conditional.

    e.g. check  Request[""] variable to identify that the event is fired because of timer event and in that case don't bind the data again.

    Let me know if this helps you.

Reply Children