locked
How to add asterisk in data table new row in asp.net C#? RRS feed

  • Question

  • User-479973300 posted

    <div>I want to bind a datatable in grid with below design

                                     S.No        Name                    Age

                                     ******        ********               *****     

                                     1              Raja                      25

                                     2              Kiran                     26

                                     3              Krish                     23

                                     ********************************

                                               Total : 3

                                                Team : IT

    how to design the grid in this format in asp.net c#? </div>

    Thursday, December 13, 2018 4:58 PM

All replies

  • User61956409 posted

    Hi rajaganapathy,

    To achieve the requirement, please refer to the following example.

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" ShowFooter="true">
        <Columns>
            <asp:BoundField DataField="SNo" HeaderText="S.No" />
            <asp:BoundField DataField="Name" HeaderText="Name" />
            <asp:BoundField DataField="Age" HeaderText="Age" />
        </Columns>
    </asp:GridView>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            bindgrid();
    
            GridView1.FooterRow.Cells.RemoveAt(0);
            GridView1.FooterRow.Cells.RemoveAt(1);
            GridView1.FooterRow.Cells[0].Text = $"Total: {num_here}" + " Team: IT";
            GridView1.FooterRow.Cells[0].ColumnSpan = 3;
        }
    }

    Test Result:

    With Regards,

    Fei Han

    Friday, December 14, 2018 3:04 AM