How to Generate Serial Number in Gridview ASP


In this tutorial we will see how  we can add Auto Generated serial number in Gridview. Before starting tutorial we assume you are aware about grid view in c # which use to display data in a grid system. Here are some simple steps for doing this. Step 1 : Create a Gridview, Simple adding From Toolbox Menu. Step 2 : Add this line inside the <Columns>——— </Columns> tag. <asp:TemplateField HeaderText=”S.No”><ItemStyle HorizontalAlign=”Center” /><ItemTemplate><asp:Label ID=”lblSerialNo” runat=”server”></asp:Label></ItemTemplate></asp:TemplateField> Step 3: add OnRowDataBound Properties in Gridview <asp:GridView ID=”GridView1″ runat=”server” CellPadding=”4″ Width=”70%” AutoGenerateColumns=”False” DataKeyNames=”id” OnRowDataBound=”GridView1_RowDataBound”…

Read More