Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
 Alphabatic filter in gridview
Posted by Rajeev on  3/4/2010 4:42:40 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend

I have a gridvview and I have bind gridview using sqldatasouce

Now I have to implement Alphabatic paging.

How I can do it.
please help me.

Post Your Reply Post New Question

 Viewer's Reply
Alphabatic filter in GridView using SQLDataSource
Answered By Moderator1 on 3/5/2010 8:48:22 PM

Please read the article in the below url to know the basic of Alphabetical Paging.

Move to section titled as "Method 3: Create Alphabetic Pager with Stored Procedure". Alphabetical Paging in GridView can be easily done using Stored Procedures. I have given the sample code for you below,

<asp:DataList ID="DataList1" runat="server" OnItemCommand="DataList1_ItemCommand"
RepeatDirection="Horizontal" DataSourceID="SqlDataSource1">
<asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Bind("PageIndex") %>'
Text='<%# Bind("PageText") %>'></asp:LinkButton>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestCnStr %>"
SelectCommand="Proc_Paging" SelectCommandType="StoredProcedure">
<asp:Parameter DefaultValue="2" Name="OptionId" />

I've called the Stored Procedure Proc_Paging from the SQLDataSource by passing parameter default value as "2". Then assign the DataSourceID of the DataList control as SQLDataSource1. Thats it.
Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
When Good HTML Goes Bad: How You Can Protect Your Web Applications
Take Advantage of Oracle's 2 Day DBA Course