Here I will explain how to show the gridview with different type of paging in asp.net.
Description:
I have one gridview with multiple number rows at that time I tried to set paging for my gridview for that I have search gridview properties at that time I found different type of paging mode styles are available in gridview for paging those are
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Show Gridview To</title>
<style type="text/css">
.Gridview
{
font-family:Verdana;
font-size:11pt;
font-weight:normal;
color:black;
width:350px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="gvEmpDetails" runat="server" CssClass="Gridview" AllowPaging="true" PageSize="4" HeaderStyle-BackColor="#7779AF" HeaderStyle-ForeColor="White" DataSourceID="dsEmpdetails">
<PagerSettings Mode="NumericFirstLast" PageButtonCount="4" FirstPageText="First" LastPageText="Last"/>
<PagerStyle BackColor="#7779AF" Font-Bold="true" ForeColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="dsEmpdetails" runat="server" ConnectionString="<%$ConnectionStrings:dbconnection %>"
SelectCommand="select * from EmployeeDetails" >
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
|
<connectionStrings>
<add name="dbconnection" connectionString="Data Source=SureshDasari;Integrated Security=true;Initial Catalog=MySampleDB"/>
</connectionStrings >
| |
<PagerSettings Mode="NumericFirstLast" PageButtonCount="4" FirstPageText="First" LastPageText="Last"/>
|
<PagerSettings Mode="Numeric" PageButtonCount="4" />
|
|
<PagerSettings Mode="NextPrevious" PageButtonCount="4" PreviousPageText="Previous" NextPageText="Next" />
|
|
<PagerSettings Mode="NextPreviousFirstLast" PageButtonCount="4" PreviousPageText="Previous" NextPageText="Next" FirstPageText="First" LastPageText="Last" />
|
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|




Subscribe by RSS
Subscribe by Email
22 comments :
very fine code sir!
thanks sir!
I have very need for this code.
good post
i use this code but get Error.
The GridView 'grdPurPlan1' fired event PageIndexChanging which wasn't handled.
hi,
check your code that was problem with your coding if you observe above code i didn't used that type of events. i thing you written event in aspx page but forgot to handle that event in code behind check your code.
Very very nice code.
Good one :) Thank you
hi suresh,
i have a problem may be you have any idea.
i want to use gridview with paging and i want when my records are shown then only next button should show in footer of gridview but when user reach on the last record then there should show "Last" that means before this last should not be show.
please give me solution.
my emailid is hello_navjot@yahoo.com
but i want gridview without setting paging=true
Hi Suresh. I am new at this gridview control. Your article is very useful. Thanks for sharing!
Hi sir, I have a problem,how to solve this, without sqldatasource, (using templated feild, edit item templated, item templated, in a gridview) how to use customPaging style....I know databinding without sqldatasource,Plz give me the tips how can i solve that one when i m using Templated feild...Thanks
can anyone help me to the above post plz. thanks in adv
its not working
awesome, thx for sharing!
thank you
hai,,can u send me the code behind for numeric first-last in gridview using c# coding
is there any provision to put "Next" and "First" labels at left hand side and "Previous" and "Last" labels on right hand side?
u can find better code than this on google
Your website is very useful for .net programmers. Thank uuuuu
http://blog.bhansalisoft.com/Posts.aspx?PostID=129
how we done paging on conditional based
suppose i have a 3 column and last column we have yes or no.i bind griddview on this condition.
in this case error occur
Keep Poasting , You are posting a good material here that helps me alot.
can you please give example of gridview custom paging with large amount of data.