DataGrid numbering column?

berniec

New Member
I'm trying to figure out the best way to render a numbering column with a DataGrid? I wan't to rank a table based on hit counts. You'd think this capability would be built into the DataGrid!I'm not sure that I understand the question.<BR><BR>You want to sort your data by HitCount order is that correct?<BR><BR>Isn't that an SQL question rather that a DataGrid specific question?<BR><BR><scratching head><BR>Hope I'm not missing something here.You want to sort your data by HitCount order is that correct?<BR> <BR>>>Yes, but I also want to rank that data with incremental numbering based on hit count.. using the dataGrid if possible.I'd declare an Integer with Global Scope and call it from a function and within the function itself increment the value of the variable. Something like this (in psuedo-code)..<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;Dim mintCounter As Integer = 0 ' Global variable<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;Protected Function RaiseNumber () As Integer<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mintCounter = mintCounter + 1 ' increment the value of<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Return mintCounter ' return value<BR>&nbsp;&nbsp;&nbsp;&nbsp;End Function<BR><BR><BR>Then down in your DataBinding Table/Grid you'd do something like this...<BR> <BR>&nbsp;&nbsp;&nbsp;&nbsp;<ASP:BOUNDCOLUMN><%# RaiseNumber() %></ASP:BOUNDCOLUMN><BR><BR>Is that what you mean??<BR><BR>
 
Back
Top