Telerik RadGrid client-side data-binding using jQuery

Posted by: the telerik blogs, on 09 Oct 2008 | View original | Bookmarked: 0 time(s)

Instead of traditional ASP.NET AJAX approach for "Exposing Web Services to Client Script" you can use jQuery and JSON2 JavaScript libraries to achieve the same very easily.

Using this simple method you can call any page method in ASP.NET Page or WebService method:

function executeMethod(location, methodName, methodArguments, onSuccess, onFail) {
$.ajax({
type: "POST",
url: location + "/" + methodName,
data: methodArguments,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: onSuccess,
fail: onFail
});
}

Here is an example also how to use JSON2 JavaScript library to serialize any JavaScript object to string:

function getRequestData(tableView) {
return JSON.stringify({
"startIndex": tableView.get_currentPageIndex(),
"maximumRows": tableView.get_pageSize(),
"sortExpression": tableView.get_sortExpressions().toString(),
"filterExpression": tableView.get_filterExpressions().toDynamicLinq()
});
}

And to use these two to bind RadGrid you can simply call:

executeMethod("WebService.asmx", "GetData", getRequestData(tableView), updateGrid);

The result: Blazing fast and responsive AJAX DataGrid:

Untitled

[Download]

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: GridView | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 6135 | Hits: 64

Similar Posts

  • How to display data from different tables using one data source more
  • Get Ready for Teleriks Custom-built Extensions for ASP.NET MVC more
  • Announcing Microsoft Ajax Library (Preview 6) and the Microsoft Ajax Minifier more
  • Binding Hierarchical RadGrid for ASP.NET Ajax with Telerik OpenAccess ORM more
  • ASP.NET AJAX 4.0 Preview 5 released to CodePlex more
  • Telerik Launches RadControls for Silverlight 3 for Line-of-Business Application Development more
  • Silverlight Release History : Q2 2009 (version 2009.2.701) more
  • WPF Release History : Q2 2009 (version 2009.2.701) more
  • Telerik Introduces Free Web Testing Framework for ASP.NET AJAX and Silverlight more
  • Telerik OpenAccess ORM and Ado.Net Data Services Example Refreshed more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD