使用AJAX响应将数据绑定到Telerik Grid [英] Bind Data to Telerik Grid using AJAX Response
问题描述
大家好,
我正在使用Telerik Grid Control.
程序:
我将从组合框中选择任何一个表名,并且在此组合框的onchange事件中,我正在执行ajax请求,现在我想使用Ajax响应将数据绑定到Telerik Grid.
一切正常,除了,使用此Ajax响应将此数据绑定到网格..
我像这样使用Combobox ...
Hai all,
I am using Telerik Grid Control.
Procedure:
I will select any one of the table name from combobox and in onchange event of this combobox i am doing ajax request and now i want to bind the data to Telerik Grid using Ajax response.
Every thing working fine except, this binding data to grid using this Ajax response..
I used Combobox like this...
@(Html.Telerik().ComboBox().Name("GridDisplayComboBox")
.AutoFill(true)
.ClientEvents(e=>e.OnChange("onChangeGDCB")))
在脚本部分,
and in scripting part,
function onChangeGDCB(e) {
var data1 = e.value;
$.ajax({ type: 'POST',
url: '@Url.Action("CallMyGrid")',
data: { data: data1 },
async: true,
success: function (response) {
var grid = $('#MyGrid').data('tGrid');'
grid.rebind( // He re i am not able to get idea for code to rebind the data to Grid...
alert('I am Grid '+response);},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.responseText);
}
});
}
有谁能帮我解决这个问题....
Can any gudie me regading this....
推荐答案
.ajax({type:' POST', url:' @ Url.Action("CallMyGrid")', 数据:{数据:data1}, 异步: true , 成功:功能(响应){ var grid =
.ajax({ type: 'POST', url: '@Url.Action("CallMyGrid")', data: { data: data1 }, async: true, success: function (response) { var grid =
(' ' ' grid.rebind(//他是我不知道将代码重新绑定到Grid的代码的主意... alert('我是网格' + response);}, 错误:函数(xhr,ajaxOptions,thrownError){ alert(xhr.responseText); } }); }
('#MyGrid').data('tGrid');' grid.rebind( // He re i am not able to get idea for code to rebind the data to Grid... alert('I am Grid '+response);}, error: function (xhr, ajaxOptions, thrownError) { alert(xhr.responseText); } }); }
任何古迪我都可以拒绝这个吗?...
Can any gudie me regading this....
这篇关于使用AJAX响应将数据绑定到Telerik Grid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!