Ads 468x60px

Friday, October 12, 2012

how to add new row in gridview in 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 using c#. see the below code and copy and past.
              int columncount = GridView1.Rows[0].Cells.Count;
              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;

1 comment:

Post a Comment