function GridHasData {
NavigateTo('RESULTS');
}
<a id='RESULTS'></a>
<div id='telerikgridcontainer'>
// grid here
</div>
But there doesn't seem to be a client-side event associated with "the grid has been populated with data". Is there a way to invoke my function from the server side after I've assigned the datasource?
Thanks
5 Answers, 1 is accepted
Please try handling the OnGridCreated client-side event of RadGrid for your purpose.
Find more information about this event here.
I hope this helps.
Greetings,
Iana
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
In order to determine if the grid has data rows or has no records displayed, you can try the below code:
| <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> |
| <script type="text/javascript"> |
| function GridCreated(sender, eventArgs) |
| { |
| if(sender.get_masterTableView().get_dataItems().length > 0) |
| { |
| //execute custom code here |
| } |
| } |
| </script> |
| </telerik:RadCodeBlock> |
| <telerik:RadGrid ID="RadGrid1" runat="server"> |
| <ClientSettings> |
| <ClientEvents OnGridCreated="GridCreated" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
I hope this would work for you.
Greetings,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
if(sender.get_masterTableView().get_dataItems().length > 0)
.
.
.
there is this error:
Microsoft JScript runtime error: 'this._tableView._owner._clientKeyValues' is null or not an object
at this location in Telerik code:
if(this._tableView&&this._tableView._owner._clientKeyValues&&this._tableView._owner._clientKeyValues[this._itemIndexHierarchical]){
this._dataKeyValues=this._tableView._owner._clientKeyValues[this._itemIndexHierarchical];
}
}
this._domEvent=_369;
Is this error the result of something I'm failing to do? I'm assigning a System.Data.Datatable as the grid's Datasource, and here is how the MasterTableView is declared in HTML:
<
telerik:RadGrid ID="RadGrid1" runat="server" ValidationSettings-EnableValidation="true" AutoGenerateColumns="False" GroupingEnabled="False" PageSize="22" GridLines="None">
<mastertableview ClientDataKeynames="id" datakeynames="id" cssclass="mastertable_default" showheader="False" gridLines="None">
Thanks for the continued help.
Your grid and MasterTableView declarations look fine to me, I cannot find any reason for the preceding error there.
I suggest that you check out the attached sample which implements the previously provided solution and see how it works and what differs in your case.
Let me know how it goes.
Sincerely yours,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.