2
Reply

how to show the row value in div inside gridview div itemtemplate column

vijay kumar

vijay kumar

14y
10.5k
0
Reply


    Just put these template field inside a grid view.


    <asp:TemplateField>
    <ItemTemplate>
    <div id = "divItemTemplate" runat = "server">
    <table>
    <tr>
    <td>
    <asp:Label ID="lblRowNo" runat="server" Text='<%# Container.DataItemIndex + 1 %>'></asp:Label>
    </td>
    </tr>
    </table>
    </div>
    </ItemTemplate>
    <HeaderStyle/>
    <ItemStyle/>
    </asp:TemplateField>

    Note: The Line Text='<%# Container.DataItemIndex + 1 %> ' will give you the count of rows in Gridview.

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"

    Height="234px" ShowFooter="True" Width="603px" CellPadding="4"

    ForeColor="#333333" GridLines="None"

    onselectedindexchanged="GridView1_SelectedIndexChanged">

    <RowStyle BackColor="#E3EAEB" />

    <ItemTemplate>

    <asp:Button ID="Button1" runat="server" CausesValidation="false" CommandName=""

    Text="Clear" />

    </ItemTemplate>