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

Empty Grid not displaying

5 Answers 232 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 18 Nov 2008, 02:58 PM
I have a search form above my grid.  When the page loads there is a container for the grid, however it is not populated with data until a search has been performed.  How can I show the empty grid on page load?  I have a ajaxManager that shows the loading.... image and it is not showing up on the first search and I would like it to be displayed.

Thanks!

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Nov 2008, 05:03 AM
Hi Mike,

Try setting the  ShowHeadersWhenNoRecords property to true in the aspx and see whether the Grid is getting displayed.

ASPX:
 <MasterTableView DataSourceID="SqlDataSource1"   ShowHeadersWhenNoRecords="true"  > 


Shinu.
0
Mike
Top achievements
Rank 1
answered on 19 Nov 2008, 01:39 PM
Shinu,

I tried that with no luck, thanks for the idea though.  Hopefully, it's just an attribute in a tag.
0
Sebastian
Telerik team
answered on 19 Nov 2008, 01:45 PM
Hi Mike,

You can assign an empty data source for the grid (inside the NeedDataSource event handler for example) in order to display the NoRecordsTemplate alongside with the column headers, for example:

//inside the NeedDataSource event handler when the condition is to have no data in the grid
<GridInstance>.DataSource = new Object[0];

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Mike
Top achievements
Rank 1
answered on 19 Nov 2008, 01:49 PM
Do I want to do this even if I'm not binding the grid on page load, and only when a search is performed?   This does work I will just use it in my page load and !IsPostBack
0
Sebastian
Telerik team
answered on 19 Nov 2008, 03:06 PM
Hi Mike,

This seems to be an alternative approach which should work properly as well. Feel free to use it if applicable.
 
Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mike
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or