You have 2 ways to do this:
1 - simulate input fields inside
<asp:GridView ID="GridView1" runat="server"> <EmptyDataTemplate> <tr> <td> First Cell </td> <td> Second Cell </td> <tb> Third Cell </tb> </tr> </EmptyDataTemplate> </asp:GridView>
2 - create an empty data set and bind it to GirdView.
If ds.Tables(0).Rows.Count > 0 Then grd_codes.DataSource = ds grd_codes.DataMember = ds.Tables(0).TableName grd_codes.DataBind() Else Try If ds.Tables(0).Rows.Count = 0 Then ds.Tables(0).Rows.Add(ds.Tables(0).NewRow()) grd_codes.DataSource = ds grd_codes.DataBind() Dim columnCount As Integer = grd_codes.Rows(0).Cells.Count grd_codes.Rows(0).Cells.Clear() grd_codes.Rows(0).Cells.Add(New TableCell) grd_codes.Rows(0).Cells(0).ColumnSpan = columnCount grd_codes.Rows(0).Cells(0).Text = "No Records Found." End If
I prefer the first method, because the Binding empty DataSet has some problems.
Emad Mokhtar May 7 '12 at 19:20 2012-05-07 19:20
source share