Click here to Skip to main content
13,357,514 members (74,054 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,

I am new to ASP.Net MVC. I am using asp.grid and objectdatasource in MVC ASPX Application. I am not able retain the values of p_startindex, datakeynames etc. In many blogs it is mentioned like viewstate is not supported in MVC. Is there any alternate method to achive my task.

The below code is placed in View/Index.aspx page

<asp:GridView ID="grVw" runat="server" DataKeyNames="Id, Name" PageSize="10"

                    AllowPaging="true" AllowSorting="true" DataSourceID="ObjectDataSource" AutoGenerateColumns="False"

                    AutoGenerateCheckBoxColumn="True" CheckBoxColumnIndex="0">
                        No Matching Records Found
                        <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
                        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:ObjectDataSource ID="ObjectDataSource" runat="server" MaximumRowsParameterName="p_maxRows"

                    StartRowIndexParameterName="p_startIndex" TypeName="MVCSampleApplication.Controllers.DefaultController"

                    SelectMethod="GetList" SelectCountMethod="GetListCount" SortParameterName="p_sortData"

                        <asp:Parameter Name="p_sortData" Type="String" />

Thank you
Posted 8-Nov-12 20:10pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180111.1 | Last Updated 9 Nov 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100