New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
OnDataBinding
Telerik.Web.UI.OnDataBinding Property
To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel.
This event will be raised when the grid is about to be bound to data client-side. Can be used to change dynamically any of the grid declarative client-side binding properties if needed.
Meaningful with client-side data-binding only!
This event will be raised twice by default - the first call will retrieve the data and the second call will fetch the total items count.
Fired by | RadGrid |
---|---|
Arguments | location - the physical location of the web service/page method which retrieves the data for the grid methodName - the name of the method which collects the data methodArguments - the arguments that will be passed to the method which gets the data (start row index, maximum rows, sort parameter, filter parameter) |
Can be canceled | Yes, set eventArgs.set_cancel(true) to cancel |
Example:
ASP.NET
<telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" runat="server">
<ClientSettings>
<ClientEvents OnDataBinding="RadGrid1_DataBinding" />
</ClientSettings>
</telerik:RadGrid>
JavaScript
function RadGrid1_DataBinding(sender, args)
{
sender.ClientSettings.DataBinding.SelectMethod = "MyGetDataMethodName";
sender.ClientSettings.DataBinding.SelectCountMethod = "MyGetCountMethodName";
}