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

Page buttons don't work when grid not ajaxified

3 Answers 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justin Lee
Top achievements
Rank 1
Justin Lee asked on 15 Jul 2010, 03:00 PM
I have RadGrid on a page the is not ajaxified (for a reason).  The page Mode is set to "NextPrevAndNumeric".  Clicking on the Numeric page buttons work, but the Next and Previous buttons do not.  When I click on them, they throw the error "Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> ..."  I set enableEventValidation="false" (just to test), and the error goes away, but the buttons do nothing.

I created a simple version to demonstrate. (remember, there is no RadAjaxManager or RadUpdatePanel on the page)

<head runat="server">
      
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server"></asp:ScriptManager>
        <telerik:RadGrid ID="theGrid" runat="server" AutoGenerateColumns="false" 
            OnNeedDataSource="theGrid_NeedDataSource"
            EnableViewState="false" AllowPaging="true">
            <MasterTableView PageSize="25">
                <PagerStyle AlwaysVisible="true" Position="Top" 
                    Mode="NextPrevAndNumeric" />
                <Columns>
                    <telerik:GridBoundColumn HeaderText="Col1" DataField="Col1">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Col2" DataField="Col2">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
          
        </telerik:RadGrid>
      
    </form>
</body>
</html>

Code Behind:
protected void theGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            DataTable tbl = new DataTable();
            tbl.Columns.Add("Col1", typeof(string));
            tbl.Columns.Add("Col2", typeof(string));
  
  
            for (int i = 0; i < 50; i++)
            {
                tbl.Rows.Add(i.ToString(), i.ToString());
            }
            theGrid.DataSource = tbl;
        }

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 15 Jul 2010, 03:56 PM
Hi Justin,

The cause for the issue is that you have disabled RadGrid's ViewState. Please enable it for proper paging.
ASPX:
<telerik:RadGrid ID="theGrid" runat="server" AutoGenerateColumns="false" 
            OnNeedDataSource="theGrid_NeedDataSource"
            EnableViewState="true" AllowPaging="true"
            <MasterTableView PageSize="25"
                <PagerStyle AlwaysVisible="true" Position="Top" 
                    Mode="NextPrevAndNumeric" /> 
                <Columns
                    .............

Greetings,
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
0
Justin Lee
Top achievements
Rank 1
answered on 15 Jul 2010, 05:04 PM
You should not need Viewstate enabled for proper paging.  All the other paging functionality works with Viewstate disabled (page size dropdown, numeric paging).  I don't want to enable viewstate just to make the first and last buttons work. 

Telerik's demos has a Grid that pages with ViewState disabled.  The demo works because the grid is Ajaxified.  If I ajaxify my grid, it also works - but on this particular page, I do not want the grid ajaxified.

0
Pavlina
Telerik team
answered on 16 Jul 2010, 12:25 PM
Hello Justin,

Please open a regular support ticket and send us small example demonstrating this and we will get back to you with more info.

Greetings,
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
Justin Lee
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Justin Lee
Top achievements
Rank 1
Share this question
or