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

Optimization and viewstate = false

1 Answer 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Atlas
Top achievements
Rank 1
Atlas asked on 01 Apr 2010, 08:58 PM
I am watching your webinar on grid optimization, and one of the recommended techniques is to disable viewstate on all read only grids.
I have several grids that are read only, but that use:
<telerik:GridButtonColumn ButtonType="ImageButton" ImageUrl="~/images/icon_page_magnify.gif" HeaderText="Select" UniqueName="Select" CommandName="Select" /> 
and an OnItemCommand, which is causing an invalid postback problem.
I realize this is a limitation in .Net, but is there some other way to create a grid navigation activity that sets a session variable and redirects to a different page that would allow me to keep the viewstate off?

I am just trying to find some other way to achieve this result while still being able to leave the viewstate off.

The onItemCommand is this:
            if (e.CommandName.ToUpper() == "SELECT")  
            {  
                Session["A"] = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["A"];  
                Response.Redirect("~/Item/");  
            }  
 

Or maybe I don't need a session variable, how else could i send the user to another page with an id without using the query string???


1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 05 Apr 2010, 02:45 PM
Hello Nano,

When you set EnableViewState set to false, RadGrid will use the page control state to store  the absolutely necessary bits of data that preserve the current paging, sorting, and grouping state.

More information is available help article:
Optimizing ViewState usage

However, a possible solution for your case would be to store the grid ViewState in the Session (after it is enabled) as explained in this documentation topic.

I hope this helps.

Regards,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Atlas
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or