This blog is about the dotnet.all types of codes,news about dotnet including asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.ncluding asp.net,vb.net,c# and know about new dotnet technology.programing in asp.net,vb.net,c#, ajax, AJAX tech support for .net and discuss the new technology in dotnet.asp.net programming,dot net programming,dotnet programs,dotnet source code,source code.

Free Hosting

Free Hosting

Friday, May 16, 2008

Create Squence No on a Datagrid with Paging

This Snip of code shows you how to create Squence No on a Datagrid with Paging.

<asp:DataGrid id="DataGrid1" runat="server" PagerStyleNumericPages   PageSize="10" AutoGenerateColumns="False" AllowPaging="True">
<Columns>

<asp:templatecolumn headertext="Row
Number">       

<itemtemplate>


<%# (DataGrid1.PageSize*DataGrid1.CurrentPageIndex)+ Container.ItemIndex+1%>
</itemtemplate>
</asp:templatecolumn>
<asp:boundcolumn   runat="server" DataField="CompanyName"
HeaderText="Company Name">

</asp:boundcolumn>
 

<asp:boundcolumn runat="server" DataField="Address"
HeaderText="Address">

</asp:boundcolumn>

</Columns>


</asp:DataGrid>


Tweak in the code is very simple, instead
of only using container.itemindex to get the sequence number. You need to
use Pagesize and currentpageindex to find out the starting number of that
page and then add container.itemindex to that.

0 comments:

dotnet(.Net) Project Source code Downloads and Tutorials

Email Subscrption



Enter your email address:

Delivered by FeedBurner

Feedburner Count

Unique Visitor

Design by araba-cı | MoneyGenerator Blogger Template by GosuBlogger