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

RadGrid and ViewState

2 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 30 Jun 2010, 09:36 PM
Hi,

I have a very strange problem with the ViewState when I use the RadGrid.

Example code:
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False"   
            DataSourceID="EntityDataSource1" GridLines="None">  
            <MasterTableView datakeynames="ProductID" datasourceid="EntityDataSource1">  
                <Columns> 
                    <telerik:GridEditCommandColumn ButtonType="LinkButton">  
                    </telerik:GridEditCommandColumn> 
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name"   
                        SortExpression="Name" UniqueName="Name">  
                    </telerik:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 

I also use a browser file with the following code.
<browsers> 
    <browser refID="Default">  
        <controlAdapters> 
            <adapter controlType="System.Web.UI.Page" adapterType="Telerik.Web.UI.RadSessionPageStateCompression" /> 
        </controlAdapters> 
    </browser> 
</browsers> 
 

When you view the sourcecode of the page, the ViewState is only a few bytes.
Now when I change the ButtonType in the GridEditCommandColumn to ImageButton, the ViewState increases to several kB's.
Disabling ViewState on the RadGrid won't help. Creating my own edit command colums with an image button doesn't fix it either.
Why is this?
And what can I do to keep my ViewState small?

Thanks,
Mark

2 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 04 Jul 2010, 01:22 PM
Bump...
Does nobody have any idea why the ViewState is getting so big when you use ImageButtons?
0
Radoslav
Telerik team
answered on 06 Jul 2010, 12:27 PM
Hi Mark,

The described behavior is expected. If you disable the compression you will find that in the first case with  GridEditCommandColumn.ButtonType set to LinkButton, the ViewState is smaller than in the second case with GridEditCommandColumn.ButtonType set to ImageButton.

Additionally we have many optimization techniques and I am sure some of them will be of great help for your project . Please check out the following forum thread which elaborate on the RadControls optimization techniques:
http://www.telerik.com/community/forums/aspnet-ajax/grid/entity-framework-and-performance.aspx

I hope his helps.

All the best,
Radoslav
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
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or