Using jQuery within HTML Helpers
The introductory posting for Razor demonstrates the construction of an HTML Helper that passes an inline template to the native Grid object. Instead, I'd like to understand what it would take to create an HTML Helper that renders to my preferred jQuery-based grid (DataTables.net) instead.
Has anyone published samples of jQuery plugins being u开发者_如何学运维sed within the new HTML Helpers?
thx
A Razor helper is just a function that outputs HTML. Most jQuery plugins would be reaonable candidates for this. You can have a certain amount of fun with named and optional parameters (which the Razor Web Pages helpers use). All you need to do is effectively expose the jQuery API as a C# one.
Creating a helper to wrap a client side Grid such as jqGrid or DataTables.NET would require a fair amount of work, judging by what's gone into the WebGrid helper.
精彩评论