How to display row# in gridview, DataGrid,Repeater or DataListGridView is one of most widely used controls and we can do lots of things with the control.
In ASP.Net 2.0, Datagrid is replaced by GridView control while Datagrid control is still supported. There are large numbers of tasks that can be done through grid view control.
<%@ Page Language="C#"%>
<script runat="server">
protectedvoid Page_Load(object sender, EventArgs e)
{
gridView1.DataSource =newstring[] { "Aamir Hasan", "www.studentacad.com", "aspxtutorial.com" };
gridView1.DataBind();
}
</script>
<html>
<head runat="server">
<title>GridView Row number's</title>
</head>
<body>
<form id="form2" runat="server">
<div>
<asp:GridView runat="server" ID="gridView1">
<Columns>
<asp:TemplateField HeaderText="#">
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
Links
GridViewRow
Author:
Aamir Hasan औथोर:
आमिर हसन أثر
أمير حسن .
8181faca-5707-4e9f-be70-81f327166f63|0|.0
ALL, asp.net
asp.net, gridview