I am providing the solution in ASP. Just convert this as you like. I have tried
this one at my end and its working fine. Just take one Template field as
Serialno. in Datagrid. Below is the code in HTML:
<
size=2>asp :
size=2>TemplateField HeaderText
color=#0000ff size=2>="Sl.no"
size=2>HeaderStyle-ForeColor
size=2>="White">
<
size=2>ItemTemplate>
<
size=2>asp:
size=2>Label ID
size=2>="lblslno"
size=2>runat="server"
color=#ff0000 size=2>Text='
size=2><%# Slcount() %>
size=2>'></asp
size=2>:Label
size=2>>
</
size=2>ItemTemplate>
</asp
color=#0000ff size=2>:
size=2>TemplateField>
Slcount() is the function which i have taken in the code page.
Take one variable Count as integer.
In the above function take Count= Count + 1. Initially count will be taken as
Zero.
Below is the code in the code page:
Dim
count as
integer
= 0
Public Function
Slcount()
as Integer
count =
count +
1
Return
count
End Function
Enjoy Coding.
|