statesdating powered by vbulletin - Gridview not updating on postback

This thing is quite simple when we are trying to update any control which is inside the updatepanel itself. We have one Button say Button1, which is also inside the Update Panel.

gridview not updating on postback-30

The gridview contians data for a questions within a dynamic questionnaire builder.

However as soon as i do anything on the page which causes a post back, for instance clicking one of the visible option links, the option link appears on all rows of the grid.

If the page postback causes the data source to be lost then how does it render the data into the grid as it doesnt appear to be rebinding? Thanks for taking the time to look at my problem Ya true. I was trying to sort the gridview and instead of my filtered data all the data was coming up. :( But as you said you are programatically creating data source it means you fire query find result set and store in dataset and than bind dataset to gridview. But when you click on any other button on page basically you are not running that query part again and thats what looses the data.

So better to store them in session and retrive on postback.

While registering we need to provide the Control name along with the data item for the control which we want to render. we can call args.get_data Items()to retreive the data from the dataitem collections.

If we click on Button1 now, it will update the text of Label1, but though we have registered the Label2 with the script manager still its value will not be reflect. After that we have set the Control Value by from the data item collection using .But ofcourse when you post back a page it will loose the data source.The solutions to this problem is either to maintain a dataview or when you fetch the data for the first time from database store that entire dataset into session and retrive it on postback from the session. Thanks chinu1310, I should also explain that i am not using any of the new datasource controls and i am programatically binding the grid to a BLL object, which happens to be an entity list.---- Not sure what the ID will be as its not a template field I really hadnt thought about the graded field as well and you are right this re-appears as well as the options link.Thanks again for taking the time to look at this Sorry but i moved on in the project and took a different approach, i should however have thanks you guys for all the effort you put in and closed it of so sorry about that.On the note of rebinding, i would prefer not to do that as there are a number of events on the page which cause the same problem. Thanks again for your help Hi Monty SR, When you postback a page there is a datasoruce attached with your gridview is also no longer available.

Tags: , ,