473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help adding a "rank" column to a sortable GridView

I have a GridvVew in which all of the columns are sortable. I want the
first column to display the position of the row in the sorted order
regardless of which column I've sorted or which direction it is
currently sorted. This "rank" column should always display like so:
1
2
3
4
5
etc...

Programmatically, the problem I'm having is that the value of row[row
number x][column number y] needs to change each time the table is
sorted. I'm starting with a DataTable filled by a database query, if
that helps. I feel like there should be an easy way to do this but I
haven't run across it anywhere.

Thanks in advance for any suggestions!
Will.

May 19 '06 #1
2 2930
You can add this to your gridview :

<asp:TemplateField>

<ItemTemplate><%#(int)DataBinder.Eval(Container,"R owIndex") + 1
%></ItemTemplate>

</asp:TemplateField>

<ru****@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
I have a GridvVew in which all of the columns are sortable. I want the
first column to display the position of the row in the sorted order
regardless of which column I've sorted or which direction it is
currently sorted. This "rank" column should always display like so:
1
2
3
4
5
etc...

Programmatically, the problem I'm having is that the value of row[row
number x][column number y] needs to change each time the table is
sorted. I'm starting with a DataTable filled by a database query, if
that helps. I feel like there should be an easy way to do this but I
haven't run across it anywhere.

Thanks in advance for any suggestions!
Will.

May 19 '06 #2

"Onwuka Emeka" <bu******@hotmail.com> ¼¶¼g©ó¶l¥ó·s»D:%2****************@TK2MSFTNGP05.phx .gbl...
You can add this to your gridview :

<asp:TemplateField>

<ItemTemplate><%#(int)DataBinder.Eval(Container,"R owIndex") + 1
%></ItemTemplate>

</asp:TemplateField>

<ru****@gmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
I have a GridvVew in which all of the columns are sortable. I want the
first column to display the position of the row in the sorted order
regardless of which column I've sorted or which direction it is
currently sorted. This "rank" column should always display like so:
1
2
3
4
5
etc...

Programmatically, the problem I'm having is that the value of row[row
number x][column number y] needs to change each time the table is
sorted. I'm starting with a DataTable filled by a database query, if
that helps. I feel like there should be an easy way to do this but I
haven't run across it anywhere.

Thanks in advance for any suggestions!
Will.


May 20 '06 #3

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

Similar topics

2
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row...
5
by: crystalattice | last post by:
I've finally figured out the basics of OOP; I've created a basic character creation class for my game and it works reasonably well. Now that I'm trying to build a subclass that has methods to...
0
by: Will | last post by:
I have searched and solutions that I have found are not working, I have a datagrid that will be updating a mysql db. Now I have a drop down that has a static collection but is dynamically selected...
39
by: OtheymAverian | last post by:
Using Access '02, Windows XP Pro SP2 I have a Report that Contains data that is sorted by name and have been asked to add a field that would output a rank based on a numerical (currency) field. ...
2
by: Medi Ochre | last post by:
I've been away from Python for some time, and I'm just starting to look at Tkinter. Just so you know, I'm coming from Visual Basic, where this would, I *think*, not have been a problem, so it must...
1
by: needhelp1 | last post by:
I have gridview with a detailsview below. When I click on 'New' in brings up the DetailsView for inserting. When I click on 'Edit' in does not brink up the DetailsView. What am I doing wrong? I...
0
by: not_a_commie | last post by:
Here is some code for the Soft Heap, taken directly from the original paper on the subject with a little help from manish_gupta. Unfortunately, it's about half as fast as a basic binary heap simply...
2
by: cerise | last post by:
I'm trying to make an object to represent a single playing card. Like if it's an EIGHT of HEARTS, the object should be "8 H". Here is what I came up with, but I keep getting the error message, ...
6
by: Ahmedhussain | last post by:
Hi there, I m doing work on a gridview and Im getting an error: A potentially dangerous Request.Form value was detected from the client (ctl00$Content$GridView1$ctl03$TextBox1="<span...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.