474,039 Members | 48,944 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

numbering rows in datagrid

Dear ASP.NET Programmers,

I am using the datagrid control (grdSPs) to display database data. The
datagrid allows paging. What I am trying to do is to insert row numbers
automatically. I can do this, but with every consequent page, the index
starts again from 1. How can I make it to continue from the row number on
the previous page?

Thanks in advance,

Buran
Nov 17 '05 #1
2 6250
maybe u should do this at datalevel
there arse some ways i gues u gould do this with dataset events
"buran" <bu***@buran.co m> wrote in message
news:OO******** ******@tk2msftn gp13.phx.gbl...
Dear ASP.NET Programmers,

I am using the datagrid control (grdSPs) to display database data. The
datagrid allows paging. What I am trying to do is to insert row numbers
automatically. I can do this, but with every consequent page, the index
starts again from 1. How can I make it to continue from the row number on
the previous page?

Thanks in advance,

Buran

Nov 17 '05 #2
Check out this code, which will do the work which you wanted

<asp:datagrid id="DataGrid1" runat="server" AllowSorting="T rue"
AllowCustomPagi ng="True" AllowPaging="Tr ue" PagerStyle-Mode="NumericPa ges"
PageSize="10" PagerStyle-NextPageText="n ext" PagerStyle-PrevPageText="P rev"
<Columns>
<asp:templateco lumn headertext="Row Number">
<itemtemplate >
<%# DataGrid1.PageS ize*DataGrid1.c urrentPageindex + Container.ItemI ndex+1
%>
</itemtemplate>
</asp:templatecol umn>
</columns>

</asp:datagrid>

--
Saravana
Microsoft India Community Star,
MCAD,SE,SD,DBA.
"buran" <bu***@buran.co m> wrote in message
news:OO******** ******@tk2msftn gp13.phx.gbl... Dear ASP.NET Programmers,

I am using the datagrid control (grdSPs) to display database data. The
datagrid allows paging. What I am trying to do is to insert row numbers
automatically. I can do this, but with every consequent page, the index
starts again from 1. How can I make it to continue from the row number on
the previous page?

Thanks in advance,

Buran

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1923
by: Wayne Aprato | last post by:
I have a report that shows the results of a query. One of the fields is an autonumber field from the query which shows for instance: 120, 121 , 122 for 3 records. Is there a way to have another field that shows the numbering starting from 1 ie. 1, 2, 3? If the records were sorted so that the first field showed the records in the order: 121, 120, 122 then I would need the second field would show them numbered as 2, 1, 3. I would also need...
20
2101
by: Prakash | last post by:
Hi ! I have a field "sub_tran_no" in my form in continuous view. When the user presses a button "Re-Number", I'd like to: 1) Save the current record pointer position 2) Save the current field which has focus 3) go to the top of the recordset & start re-numbering the "sub_tran_no" field with the values 1,2,3, until eof.
3
2569
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would look like this :
5
9191
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within a datagrid do >> not << constitute a set of 'selected' records. Apparently one and only one row may be 'selected' in a datagrid. By selected row I mean the row
3
2280
by: Carolyn Vo | last post by:
I have a datagrid in my web control class that I am trying to get the current rows displayed for. I have enabled paging on the datagrid so if the user is currently on page 3 of 8, and if I have allowed for the table to show only 5 rows at a time, for example, I want to get the 5 rows that are displayed on page 3 of 8. How do I do this???? Thanks!
1
391
by: buran | last post by:
Dear ASP.NET Users, How can I get the total number of rows selected by the command text of the datagrid (items in datagrid)? If I use the statement grdSP.Items.Count with the datagrid grdSP with paging, it returns the page size (5,10..) not the total results. How can I get the total no? Thanks in advance, Buran
3
4907
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
1
4635
by: Tim Newton | last post by:
Hi Anyone tell me how to number the rowheaders of a datagrid, e.g. 1,2,3,4,5 etc, just like in excel. I could put the row numbers in a new column but there has to be a simple way of adding it to the rowheader?? Thanks Tim
0
1624
by: saraDotNet | last post by:
Hi, I'v Two Questions: 1-Is there a way to make an auto numbering avalible in vb.net form textbox as the one in Access db columns when we set the datatype as autonumbering?? 2- I'm working on a project on the vb.net forms,I made a datagrid displaying data from the source tables in an Access db. it can add row(s) at once,search,and delete specific row(s) ,but I can't update it's row(s),unless I made the update button open another form...
0
1810
by: rn5a | last post by:
All the rows in a DataGrid are accompanied by a CheckBox. When a user checks the rows & clicks a Button, the checked rows get deleted. For e.g. assume that the DataGrid displays 10 rows. A user checks the rows 2, 4, 6, 8 & 10. When he clicks the Button, the page posts & the next page displays only 5 rows i.e. row 1, 3, 5, 7 & 9. The checked rows are populated in a ViewState variable & will have values like 2, 4, 6, 8, 10, (note that there...
0
12121
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11591
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11983
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10297
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6814
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5401
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4933
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.