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;
1 comment:
Adding rows to GridView in C#.NET
Post a Comment