473,769 Members | 5,374 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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...

Programmaticall y, 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 2957
You can add this to your gridview :

<asp:TemplateFi eld>

<ItemTemplate>< %#(int)DataBind er.Eval(Contain er,"RowIndex") + 1
%></ItemTemplate>

</asp:TemplateFie ld>

<ru****@gmail.c om> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.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...

Programmaticall y, 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******@hotma il.com> ¼¶¼g©ó¶l¥ó·s»D: %2************* ***@TK2MSFTNGP0 5.phx.gbl...
You can add this to your gridview :

<asp:TemplateFi eld>

<ItemTemplate>< %#(int)DataBind er.Eval(Contain er,"RowIndex") + 1
%></ItemTemplate>

</asp:TemplateFie ld>

<ru****@gmail.c om> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.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...

Programmaticall y, 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
6551
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 *that is going to be deleted* into another table, before the original data is deleted. I am trying to use the RowDeleting method to call an Update or Insert
5
3675
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 determine the rank of a character but I keep getting errors. I want to "redefine" some attributes from the base class so I can use them to help determine the rank. However, I get the error that my base class doesn't have the dictionary that...
0
1511
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 to a selected value thats in the database. I click the edit button in the gridview and the drop down shows up fine, I pick a number in the drop down and hit update it says at that new number but the database never updates.....help anyone know...
39
7134
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. Example Report structure as it is now (dashes added for spacing purposes) Name-----------Score ---------------------------- ABC------------------10 BCD------------------25
2
1553
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 be a case of getting my head around the Tkinter way of doing things. In a nutshell, I've written an app wherein I wish to update the display often. What's happening is that I get *no* display until main() hits win.mainloop(). I've indicated the...
1
5029
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 totally at a loss, please help. I don't know if I need to something to grdUserProfile_RowEditing. Thank you! This is some of my code behind: protected void grdUserProfile_RowEditing(object sender, GridViewEditEventArgs e) { } protected void...
0
1838
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 because of memory allocation. In fact, my profiler says that 90% of the time in this sucker is memory allocation. Can anybody devise a way to cut down on the number of "news" in this? I need to insert a few million elements and remove a tenth of...
2
1493
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, "DisplayDeck.java:12: switchRank(int) in DisplayCards cannot be applied to () sRank = dispCards.switchRank();" . The error points out the dot in "dispCards.switchRank()". Can someone help me out? Thank you.
6
4280
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 class='txtColo...") Im using an access database. and when ever I try to update this it doesnt work. <%@ Page Language="C#" MasterPageFile="Mysite.master" Title="Untitled Page" %> <script runat = "server"> protected void Page_Load(object sender,...
0
10215
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...
1
9996
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
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7410
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
6674
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
5307
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3964
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
3564
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.