how to add new row in gridview in asp.net using c#

In this web programming tutorial we will learn how we can add new column in a Gridview when there is no record and we want to show a proper message that there is no data against particular search in asp.net using c#. see the below code and copy and past.
          
              int columncount = GridView1.Rows[0].Cells.Count;
              GridView1.Rows[0].Cells.Clear();
              GridView1.Rows[0].Cells.Add(new TableCell());
              GridView1.Rows[0].Cells[0].ColumnSpan = columncount;
              GridView1.Rows[0].Cells[0].Text = "No Record Found ";
              GridView1.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
              GridView1.Rows[0].Cells[0].ForeColor = System.Drawing.Color.Maroon;
          

Admin

A Software Engineer, Social Media Marketing Expert, writer,

1 Comments

Previous Post Next Post