By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,040 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

generate serial number automatically in gridview

100+
P: 375
A big hello to everyone

I have dropped on a gridview on asp.net coding done is C# 2005.
Here I display the records when a certain condition satisfies.
eg. I want to display the details of all employess who has been employeed between a certain period.
I place the query and do get the results.
eg. there are five records
101 aaa ddd eee
102 bbb ccc ddd
.
.
105 ccc ddd eee

Now I want to display in the first column the serial number.
1 101 aaa ddd eee
2 102 bbb ccc ddd
3 .
4 .
5 105 ccc ddd eee

How do i generate automatically serial numbers.

Thank you
Aug 13 '07 #1
Share this Question
Share on Google+
1 Reply


100+
P: 375
A big hello to everyone

I have dropped on a gridview on asp.net coding done is C# 2005.
Here I display the records when a certain condition satisfies.
eg. I want to display the details of all employess who has been employeed between a certain period.
I place the query and do get the results.
eg. there are five records
101 aaa ddd eee
102 bbb ccc ddd
.
.
105 ccc ddd eee

Now I want to display in the first column the serial number.
1 101 aaa ddd eee
2 102 bbb ccc ddd
3 .
4 .
5 105 ccc ddd eee

How do i generate automatically serial numbers.

Thank you
Solved
its as below
<ItemTemplate><%# Container.DataItemIndex+1 %>
<asp:Label ID="lblSerialNo" runat="server"></asp:Label>
</ItemTemplate>
Aug 13 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.