Riddhi Valecha

Riddhi Valecha

  • 439
  • 3.3k
  • 414.7k

Gridview - Dataitemindex from code-behind - Urgent

Sep 16 2015 6:30 AM
Hi all..
 
Please help me out with code-behind coding ..
 
I have a method -
private void BindGridView()
{
Datatable table ;
Gridview grdv ;
table = new Datatable();
grdv = new GridView();
if(table != null) 
{
 grdv . datasource = table;
 grdv.databind();
 
Here -
I want the following -
<asp:TemplateField>
<ItemTemplate>
<asp:label id = "lbl" runat="server" text = Container.dataitemindex + 1 >
 </ItemTemplate>
</asp:TemplateField>
How to do this is code - behind ?? Please guide !!
}
 
}
 
My Requirement is - I have to do nothing on aspx page.
 
I have to do all in code-behind - Default.aspx.cs page.
 
Please help..its a bit urgent... Thanks in advance !! 

Answers (3)