This is a migrated thread and some comments may be shown as answers.

RadGrid visible even without data

2 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
El
Top achievements
Rank 1
El asked on 09 Jan 2009, 08:38 AM
Is it possible to make the Grid control visible even if datatable is empty.
I just need the command line with Insert and refresh buttons to be there all the time.
Say you start a new project so there is no data into database. How about that?

Thank you

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 09 Jan 2009, 09:57 AM
Hello,

The GridControl will not be visible if the DataSource for the grid is empty, i.e., if you have set
RadGrid1.DataSource = null or RadGrid1.DataSourceID = String.Empty

You can replace this by using 'RadGrid1.DataSource= new string[] {}' instead, which will render the RadGrid on the page even when no records are present.

You can also try setting the ShowHeadersWhenNoRecords property of the MasterTableView to true as shown below:
aspx:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"
      <MasterTableView CommandItemDisplay="Top" ShowHeadersWhenNoRecords="true" > 
      .....        

Thanks
Princy.
0
El
Top achievements
Rank 1
answered on 09 Jan 2009, 01:33 PM
Thank you Princy. That did the trick!
Tags
Grid
Asked by
El
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
El
Top achievements
Rank 1
Share this question
or