Hi,
I am using UltraWebGrid . Binding it through OnInitializeDataSource event handler to use ajax. it contains hierarchical data. when I expand one of hierarchy it post backs and gets a new rows from database.
what I want is to retain the state of grid when I move columns of grid or refreshes a page.
it reset's grid to default position where all heirarchies collapsed and on a first page of paged grid.
I know this is problem of PostBack but I dont know what is the solution. As I want Ajax and retaining the state at the same time.
Please help.
Using this event to bind the grid has advantages and disadvantages. The view state is really small, but the state of the rows is lost. It sounds like for your scenario you're better off not using this event, but putting all of the rows into the view state by simply setting the DataSource property and calling DataBind() on the initial post back.
Another thing you can try is keep using InitializeDataSource and setting DisplayLayout.XmlLoadOnDemandType=Accumulative.
Sory for the delay
I tried DisplayLayout.XmlLoadOnDemandType=Accumulative but it is not solves my problem of retaining state.
as if navigate to second page and says F5 refresh , it again goes to the 1st page of grid.
It may be possible I am not using this event appropriatly, if so plesae let me know the perfect way.
I am directly binding the dataset to the ultragrid in InitializeDataSource event.
If you refresh the page it is getting back to its original state. Which is the way the browsers are supposed to work.
To implement what you're talking about, I am think some sort of session tracking mechanism is needed so it would remember all of the expanded rows and restore them from session on every page load.
This is not built into the grid and needs to be implemented externally.
I too am facing similar kind of issue. I have an Ultrawebgrid inside the <ASP:UpdatePanel> and i have save button which does some tasks and return the page with updates made to the Database. I have a reset button, which is used to reset back the data into its original form which was there before making any updates. If I go ahead and filter on the bais of some column in the UltrawebGrid and click save to save it, it saves the data but comes back with all the data (removing the filters). Not the one which was there after filtering. If i filter it again and click on save again, it shows up the filtered data. If i click on the Refresh button it always comes back with the last saved data, as reloads the page using response.Redirect to the same page again.
I have an other problem where after navigating to the other page from first page in the grid, next tym it still stays in the same page, its not displaying the values in the first page instead it shows the values in the page which navigated before the postback