I have a Telerik RadGrid in which I’m implementing custom paging binding to a Ajax Service. How do you pass data like a Search String to the Web Method?
The Mark up looks something like this:
<telerik:RadGrid ID="radGridProviders" runat="server" AllowPaging="True" PageSize="10" AutoGenerateColumns="false" >
<PagerStyle Mode="NextPrevAndNumeric" />
<MasterTableView TableLayout="Fixed" >
<Columns>
...
</Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="True" EnableVirtualScrollPaging="True" UseStaticHeaders="True">
</Scrolling>
<DataBinding Location="/AjaxServices/SearchService" SelectMethod="GetProductData" SelectCountMethod="GetProductCount" StartRowIndexParameterName="startRowIndex" MaximumRowsParameterName="maxRows" />
<ClientEvents OnCommand="showLoadingPanel" OnDataBound="hideLoadingPanel" />
</ClientSettings>
</telerik:RadGrid>
I want to pass to my Service a search string and/or other customer parameters How do I do it with the RadGrid Binding?
My service that responds to the requests is an ASP.NET MVC Controller. The service responds fine to requests from the browser. My problem is that I don’t know how to pass custom data using the Telerik binding features.
public class SearchServiceController : Controller
{
private ISearchController _searchController;
public SearchServiceController(ISearchController searchController)
{
_searchController = searchController;
}
public int GetProductCount()
{
int returnValue = 0;
// brevity brevity
return returnValue ;
}
public List<SearchProviders_Result> GetProductData(int startRowIndex, int maxRows)
{
// brevity brevity
}
}
Any Suggestions?
This is what I found with a little help from Telerik Support.
In the ClientSetting of the RadGrid add a method to the ClientEvents OnDataBinding. My name method name is OnClientDataBinding in this example
Then create the client method:
I actually modified the sortExpression and fitlerExpresion and these are passed as an Array.
Then create your Service Controller Method something like:
FilterExpression[] is an object that I created for my use. This is not a Telerik object.