AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
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
Hi

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
Hi,

Please read the article in the below url to know the basic of Alphabetical Paging.
http://www.aspdotnetcodes.com/Asp.Net_Alphabetical_Paging_Control.aspx

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">
<SeparatorTemplate>
|
</SeparatorTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%# Bind("PageIndex") %>'
Text='<%# Bind("PageText") %>'></asp:LinkButton>
</ItemTemplate>
</asp:DataList>

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

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
The Art & Science of JavaScript - Free 100 Page Preview!
Web Application Security — How to Minimize Prevalent Risk of Attacks
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!