angelIII,
I am using GridView instead of DataGrid. The above seems to work for datagrid but not gridview.
Could you also help me out on another question? I thank you in advance.
Main Topics
Browse All TopicsI have below gridview and sqldatasource.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False
DataSourceID="SqlDataSourc
ForeColor="#333333" GridLines="None" EmptyDataText="No results returned" EnableSortingAndPagingCall
<Columns>
<asp:BoundField DataField="AccountID" HeaderText="AccountID" InsertVisible="False"
ReadOnly="True" SortExpression="AccountID"
<asp:BoundField DataField="UserID" HeaderText="User ID" SortExpression="UserID" />
<asp:BoundField DataField="FullName" HeaderText="Name" SortExpression="FullName" />
<asp:BoundField DataField="Role" HeaderText="Role" SortExpression="Role" />
<asp:BoundField DataField="CompanyName" HeaderText="Company" SortExpression="CompanyNam
<asp:BoundField DataField="T1" HeaderText="T1" SortExpression="T1" />
<asp:BoundField DataField="T2" HeaderText="T2" SortExpression="T2" />
<asp:BoundField DataField="T3" HeaderText="T3" SortExpression="T3" />
<asp:BoundField DataField="BT" HeaderText="BT" SortExpression="BT" />
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
</Columns>
<PagerSettings Position="Top" Mode="NumericFirstLast" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Right" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CaasConn
SelectCommand="Select AccountID, UserID, FullName, Case RoleType When 0 Then 'Admin' Else 'User' End 'Role', t2.CompanyName, Case T1 When 1 Then 'Y' Else 'N' End 'T1', Case T2 When 1 Then 'Y' Else 'N' End 'T2', Case T3 When 1 Then 'Y' Else 'N' End 'T3', Case BT When 1 Then 'Y' Else 'N' End 'BT', Case t1.Status When 1 Then 'Active' Else 'Disabled' End 'Status'
From tblAccount t1 Inner Join tblCompany t2 On t1.CompanyID = t2.CompanyID
Where 1 = 0
Order By UserID"></asp:SqlDataSourc
I also have a submit button. On submit, I will build a sql statement dynamically and rebind the gridview as below.
protected void btnSearch_Click(object sender, EventArgs e)
{
///////
SqlDataSource1.SelectComma
SqlDataSource1.SelectComma
GridView1.DataBind();
}
All works but problem arises when I click on next page index of gridview. I enable paging for my datagrid. On click of another page index, no results is returned by the datasouce. How come?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: angelIIIPosted on 2007-10-28 at 08:38:31ID: 20165355
you need to implement the PageIndexChanged event of the datagrid, and rebind the data view.
m/kb/Artic le2863.asp x
see here:
http://www.dotnetspider.co