如何使用基于下拉列表选择的ajax / jquery调用绑定gridview [英] How to bind gridview using ajax/jquery call based on dropdown list selection
本文介绍了如何使用基于下拉列表选择的ajax / jquery调用绑定gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有下拉列表,下拉列表的值是表(sql表)。当我从下拉列表中单击表名称时,我需要以网格视图或表格格式显示表格。
注意:使用ajax / jquery call& web方法仅在ASP.NET c#中。
我尝试过:
我试过但没有得到任何解决方案。帮助我们。
I have drop down list,the values of the drop down list are tables(sql tables).while i click table name name from drop down list i need to display the table in grid view or table format.
Note:using ajax/jquery call& web method only in ASP.NET c#.
What I have tried:
I tried but didnt get any solution.Help me guys.
推荐答案
试试
<大> ASPX
try
ASPX
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="jquery.min.js"></script>
<title></title>
<script>
function funChangeTable(ddlObj) {
var name = ddlObj.value;
.ajax({
url:'WebForm1.aspx / GetTableData',
数据:JSON.stringify({tableName:name}),
类型:'post',
contentType:application / json; charset = utf-8,
dataType :json,
成功:函数(响应){
var json = JSON.parse(response.d);
generateTable(json);
},
错误:函数(a,b,c){
console.log(a,b,c);
}
});
}
函数generateTable(json){
var
.ajax({ url: 'WebForm1.aspx/GetTableData', data: JSON.stringify({ tableName: name }), type: 'post', contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { var json = JSON.parse(response.d); generateTable(json); }, error: function (a, b, c) { console.log(a, b, c); } }); } function generateTable(json) { var
table =
这篇关于如何使用基于下拉列表选择的ajax / jquery调用绑定gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文