Reason: jquery is simple, compatible, and easily encapsulated. Let's talk a little bit about it. Let's start writing the Jquery plug-in now. There should be many people who have written similar plug-ins, and I also have some forms that mimic flexGrid.
Requirement: display data in the GridView, no refreshing paging, no refreshing sorting, no refreshing filtering (search for data), and implemented based on ASP. NET (we have implemented ashx processing files here ).
Technologies used: asp. net2.0, jquery, and css
First, I wrote about the jquery plug-in. The core function is jquery's ajax function, which is convenient and quick.
Copy codeThe Code is as follows:
$. Ajax ({
Type: p. method,
Url: p. url,
Data: param,
Success: function (msg ){
$. AddData (msg, showbox, p );
},
Error: function (msg) {$. ErrorAjax (showbox, p. errorMsg );},
BeforeSend: function () {$. AddLoading (showbox );},
Complete: function () {$. MoveLoading (showbox );}
});
After reading this simple sentence, jquery is quite cool. For specific code, download the following attachment.
Let's take a look at the result graph after generation. (The style is not very nice. You need to modify the style by yourself)
Sorting and filtering
Jquery + ashx's refreshing paging Function
In fact, in addition to the main architecture of jquery acting as the entire plug-in, another important file is ashx, which generally processes files. Ashx outputs json Code such as {\ n page: 1, \ ntotal: 0, pages: 1, rows: '', cols:''} in my entire jqueryGrid plug-in, I believe all the friends who have used josn will understand. I used a third-party plug-in Newtonsoft. Json to reduce errors. This is the JsonConvert. DeserializeObject () function for formatting the json string.
Of course, this function plug-in is suitable for web applications and internal websites. It is not suitable for websites. After all, it is not a good display method for the data directly generated by jquery from the SEO perspective. Let's not talk about it. You can check out my code. If you have better suggestions or modifications to this plug-in, please contact us.
Jquery + ashx no-refreshing GridView data display plug-in download