如何使用带有ASP服务器控件的jquery获取数据 [英] How to fetch data using jquery with ASP server controls
本文介绍了如何使用带有ASP服务器控件的jquery获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用带有分页的jquery以及其中的asp服务器控件从数据库中获取数据? 我试着这段代码。但我怎么能在其中添加服务器控件,因为我需要它根据用户权限添加加密的超链接。
我尝试过:
https://www.aspsnippets.com/Articles/Display-Large-Amount-of honor-in- GridView-with-Search-functions-in-ASPNet-using-jQuery.aspx
解决方案
数据表示控件,如GridView
在服务器上绑定,因此在其中添加控件应该在服务器上完成 - 否则如果你在客户端添加/注入一个元素(JavaScript
)他们它会在回发时消失。您可能希望使用允许您执行所需操作的客户端Grid。想法是从服务调用中获取所有记录(假设您使用AJAX
来填充网格),然后从中搜索记录,然后重建客户端GridView
以及要添加的超链接
元素。
一个例子是使用bootstrap数据表:使用dataTable.js进行排序,搜索和分页的自举表(响应)[^]
你可以看到直播这里演示:带有分页和搜索选项的表格演示[^]
How can I fetch data from database using jquery with paging along with asp server controls in it? I tried this code.But how could I add server controls in it as I need it to add the encrypted hyperlinks to it based on user permissions.
What I have tried:
https://www.aspsnippets.com/Articles/Display-Large-Amount-of-Data-in-GridView-with-Search-functionality-in-ASPNet-using-jQuery.aspx
解决方案
A Data Representation control such asGridView
is binded at the server, thus adding controls within it should be done at the server - otherwise if you add/inject an element at the client (JavaScript
) they will be gone when it postbacks. You may want to use a client-side Grid that allows you to do what you want. The idea is to grab all the records from a service call (assuming you are usingAJAX
to populate your grid) and then search the records from it and then rebuild your client-sideGridView
along withhyperlink
elements that you want to add.
One example is using bootstrap datatables: Bootstrap Table With Sorting, Searching and Paging using dataTable.js (Responsive)[^]
You can see the live demo here: A demo of table with pagination and search options[^]
这篇关于如何使用带有ASP服务器控件的jquery获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文