Wednesday, March 28, 2012

Tab Container and GridView

Hello

Does any peopel try to use the GridView Paging with the Tab Container? It is because when I try to click to page 2.

Following problem occurred.

Specified argument was out of the range of valid values.
Parameter name: The StartRowIndex '10' is out of range. Current item count is '0'

Hi Hnchan,

Here is the sample which you can reference to. Please compare it with yours.

<%@. Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Panel ID="Panel2" runat="server"> <ajaxToolkit:TabContainer ID="TabContainer1" runat="server"> <ajaxToolkit:TabPanel ID="TabPanel1" runat="server"> <HeaderTemplate> Tab1</HeaderTemplate> <ContentTemplate> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="EmployeeID" DataSourceID="SqlDataSource1" AllowPaging="true" PageSize="3"> <Columns> <asp:BoundField DataField="EmployeeID" HeaderText="EmployeeID" InsertVisible="False" ReadOnly="True" SortExpression="EmployeeID" /> <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" /> <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" /> <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /> <asp:CommandField ShowEditButton="True" /> </Columns> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString%>" SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Title] FROM [Employees]"></asp:SqlDataSource> </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel ID="TabPanel2" runat="server"> <HeaderTemplate> Tab2 </HeaderTemplate> <ContentTemplate> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> </asp:Panel> </form></body></html>
Also you can add an UpdatePanel and put the GridView inside the UpdatePanel .Thanks.
Best regards,
Jonathan

I am sorry to say that it still does not work. Is this the problem related the ObjectContainerDataSource from WCSF?


Hi Hnchan,

So what's your Ajax Control Toolkit's version? Mine is V10618.

hnchan:

Is this the problem related the ObjectContainerDataSource from WCSF?

It's hard to say.Would you please wholly copy my source code and have a test.If all these don't work, we really need more information to find out the exact root cause.

I hope this help.

Best regards,

Jonathan

No comments:

Post a Comment