This is a migrated thread and some comments may be shown as answers.

Grid ViewState Not Preserving

5 Answers 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 19 Oct 2012, 02:08 PM
Hi, all.

I have a question regarding the RadGrid's view state on the client side.  I have a RadGrid sitting inside an .ascx control that is embedded inside a RadDock.  I have the grid's EnableViewState property set to "true" and the GroupingEnabled property set to "true", the MasterTableView's GroupLoadMode set to "client" and the CientSettings have the AllowDragToGroup property set to "true".  The grid is wrapped in an UpdatePanel, and it's also tied to a RadAjaxManagerProxy control since I already have a RadAjaxManager on the master page.

The control loads just fine, and I can group one item.  However, when I go to group another item, the first grouping level is removed; I can effectively have only one group set (the data itself is rebinding properly).  If I try a sort while the group is in place, it's also removed after the sort finishes. In addition, if I try to remove the one group that's there, I get an Index Out of Range Javascript error.

From what I can tell, I have the grid set up properly.  Is there something else I need to take into account to preserve the view state?

5 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 24 Oct 2012, 06:14 AM
Hello Jeff,

The described issue is very strange. We have not encountered it so far and we are not sure what could be the reason for experiencing the problem. Could you please post your aspx page markup with the related code behind? Thus we will be able to get more information about your scenario and provide you more to the point answer.
At a meantime could you please try removing the asp:UpdatePanel or RadAjaxManagerProxy control and let me know if the issue still persists.

Looking forward for your reply.

Regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jeff
Top achievements
Rank 1
answered on 24 Oct 2012, 04:39 PM
Hi, Radoslav.

I took out the proxy and the update panel, but the issue is still persisting.  Stepping through the code, it looks like the SaveDockLayout and LoadDockLayout procedures are being called and so I think the RadGrid is returning to its default state of having no groups and then applying the new grouping level.  This is a pretty complex project so I don't know if I can get the code isolated, but I'll see what I can do.

Thanks for your help!

/jeff
0
Jeff
Top achievements
Rank 1
answered on 08 Nov 2012, 01:08 PM
I was able to take the grid I have and put it into a smaller project; it works like it should.  Since nothing was changed code-wise between the test and my actual project, I have to assume that there's something that's causing the grid to revert to its default state when the layout saves and reloads.  Is there a way to stop that from happening when grouping or sorting occurs?  I have the grid wrapped in an Update Panel already, but it doesn't seem to help.
0
Radoslav
Telerik team
answered on 13 Nov 2012, 08:06 AM
Hi Jeff,

It is hard to say what is causing the described issue without reproduce it on my side. Could you please post your aspx markup code with the related code behind. Thus I will be able to create a small project based on them, debug it and provide a solution. Additionally the RadGrid can revert to its initial state only when the explicit Rebind method is called. So could you please verify that you do not call Rebind() method of the RadGrid explicitly? Also if you create the RadDock dynamically please verify that you created it as is described in the following articles:
http://www.telerik.com/help/aspnet-ajax/dock-control-creation.html
http://www.telerik.com/help/aspnet-ajax/dock-widgets.html
http://www.telerik.com/help/aspnet-ajax/dock-control-lifecycle.html

Looking forward for your reply.

Kind regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jeff
Top achievements
Rank 1
answered on 14 Nov 2012, 01:24 PM
Hi, Radoslav.

I figured it out; in the "LoadWidget(dock)" control of the "My Portal" demo, there's a line setting the view state of the control to false.  I went back through the sample you had sent and saw that you didn't have that line in there.  I changed mine to read ViewState=True and now everything works as it should.

Thanks for your help!
Tags
Grid
Asked by
Jeff
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or