Remove Border With For Footer Gridview row RRS feed

  • Question

  • User2033107836 posted


    I'm using This code

     protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
            foreach (TableCell cell in e.Row.Cells)
                cell.BorderColor = System.Drawing.Color.Black;
                cell.BorderWidth = new Unit(2);
                cell.BorderStyle = BorderStyle.Solid;

    its showing border for all, but i dont want to put for footer template how to remove so

    Wednesday, February 22, 2017 8:41 AM


  • User-1509636757 posted

    You can do that by making use of HeaderStyle, ItemStyle and FooterStyle for TemplateField. Here is one example:

    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" ShowFooter="true" GridLines="None">
                    <asp:CheckBox ID="chkHeader" runat="server" CssClass="chkHeader" />
                    <asp:CheckBox ID="chkSelect" runat="server" CssClass="chkSelect" />
                <FooterStyle BorderStyle="None" />
                <ItemStyle BorderStyle="Solid" />
                <HeaderStyle BorderStyle="Solid" />
            <asp:TemplateField HeaderText="QPP" SortExpression="QPP">
                    <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("QPP") %>'></asp:TextBox>
                    <asp:Label ID="Label7" CssClass="Label7" runat="server" Text='<%# Bind("QPP") %>'></asp:Label>
                <FooterStyle BorderStyle="None" />
                <ItemStyle BorderStyle="Solid" />
                <HeaderStyle BorderStyle="Solid" ForeColor="Teal" />


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, February 22, 2017 9:34 AM