displaying the column with numbers on page load

Posted by Arun11 under ASP.NET on 7/8/2011 | Points: 10 | Views : 1013 | Status : [Member] | Replies : 3
Hi,


I have 3 columns S.No, TemplateName,and date(25 records). On page load i am displaying template names and the respective dates from the database on the datagrid. But the S.No column is blank. Now i want it to fill this column from No. 1 to 25.


how can i do this?please suggest me.


Thanks,




Responses

Posted by: Ndebata on: 7/8/2011 [Member] Starter | Points: 25

Up
0
Down
There are many ways you can achieve this
1. If your using SQL server 2005 or above, you can use Row_Number() function for that.
http://msdn.microsoft.com/en-us/library/ms186734.aspx
or
2.You can write in a column of gridview
<%# Container.DataItemIndex+1 %> 



Arun11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Arun11 on: 7/8/2011 [Member] Starter | Points: 25

Up
0
Down
hey telerik radgrid doesnt support dataItemIndex.do you have any solution for this?

Arun11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 7/8/2011 [Member] Starter | Points: 25

Up
0
Down
You can use the approach number 1, i mean use row_number() function in database to populate data for this column.

Arun11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response