RadGrid OnNeedDataSource when the returned datasource is empty, I get a "Cannot find any bindable pr
- by Matt
RadGrid OnNeedDataSource when the returned datasource is empty (not null), I get a "Cannot find any bindable properties in an item from the datasource"
This is how I have my RadGrid defined in the ASP markup
<telerik:RadGrid runat="server" ID="RadGridSearchResults"
AllowFilteringByColumn="false"
ShowStatusBar="true" AllowPaging="True"
AllowSorting="true" VirtualItemCount="10000"
AllowCustomPaging="True"
OnNeedDataSource="RadGridSearchResults_NeedDataSource"
Skin="Default" GridLines="None" ShowGroupPanel="false"
GroupLoadMode="Client">
<MasterTableView Width="100%" >
<NoRecordsTemplate>
<asp:Label ID="LabelNoRecords"
runat="server" Text="No Results Found for your Query"/>
</NoRecordsTemplate>
</MasterTableView>
<PagerStyle Mode="NextPrevAndNumeric" />
<FilterMenu EnableTheming="True">
<CollapseAnimation Duration="200" Type="OutQuint" />
</FilterMenu>
</telerik:RadGrid>
Here is my OnNeedDataSource
protected void RadGridSearchResults_NeedDataSource(object source,
GridNeedDataSourceEventArgs e)
{
RadGridSearchResults.DataSource = GetSearchResults();
}
And here is my GetSearchResults()
private DataTable GetSearchResults()
{
DataTable dataTableResults = new DataTable();
// Get my data results -- When I get no results, I have a datable with 0 rows
return dataTableResults;
}
This works great when I have results in my DataSet and other tables of mine setup similarly work with the NoRecordsTemplate tag when results are empty. Any clue?