RadGrid – Values not retained after Postback

radgrid

The RadGrid is generated from the server-side with template fields. NeedDataSource() is what is used for data binding. On every postback, RadGrid loses the values as the NeedDataSource is not called.Manually doing a Rebind() on the Onload() does not help either.

The Grid Structure is defined in OnLoad() and executed once on !IsPostback()

I remember reading somewhere that when building the Grid structure dynamically from the serverside, the grid 'needs' to be Rebind() on every postback.

Does RadGrid not maintain the values on postback? Is this something to do with ViewState?

Best Answer

The "NeedDataSource" event should occur on postbacks as well. You could try setting up your page using an RadAjaxManager I suppose. Does your grid load data on the first load? Try following the demo pages they have set up on the grids, as its one of the best examples of the different ways to set them up.

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/simplebinding/defaultcs.aspx

Related Topic