我没有将控件放入方法中. [英] I didn't get the Controls inside a method..
问题描述
亲爱的先生,
我正在asp.net中进行项目,并且遇到问题.
我正在使用jquery ajax代码发布到窗口后面的代码.这是下面的代码.
Dear Sir,
I am doing a project in asp.net, and am stuck with an issue.
I am using jquery ajax code for post to code behind window. Here is the Below code.
$.ajax({
type: "POST",
url: "Home.aspx/ShowBooked_Items", // the method we are calling
contentType: "application/json; charset=utf-8",
data: JSON.stringify({ "Item_ID": $(this).attr('id') }),
dataType: "json",
success: function (result) {
ShowPopUp();
},
});
这是后面的代码中使用的代码,
And here is the Code that am using in code behind,
[WebMethod]
public static void ShowBooked_Items(int Item_ID)
{ // something
}
上面的代码正常工作.但是,当我在"ShowBooked_Items"方法中放入一些用于绑定网格的代码时,却没有在该方法中获得网格.我没有在该方法内得到任何控制
请帮帮我,
谢谢
Dileep
The above codes are working properly. But when i put some code for bind the Grid in the "ShowBooked_Items" method, but i didn''t get the grid in that method . I didn''t get any control inside that method
Please Help me,
Thanks
Dileep
推荐答案
.ajax({ 类型:" , 网址:" ,// 我们正在调用的方法 contentType:" , 数据: JSON .stringify({" :
.ajax({ type: "POST", url: "Home.aspx/ShowBooked_Items", // the method we are calling contentType: "application/json; charset=utf-8", data: JSON.stringify({ "Item_ID":
(此).attr(' id')}), dataType:" , 成功:功能(结果){ ShowPopUp(); }, });
(this).attr('id') }), dataType: "json", success: function (result) { ShowPopUp(); }, });
这是后面的代码中使用的代码,
And here is the Code that am using in code behind,
[WebMethod]
public static void ShowBooked_Items(int Item_ID)
{ // something
}
上面的代码正常工作.但是,当我在"ShowBooked_Items"方法中放入一些用于绑定网格的代码时,却没有在该方法中获得网格.我没有在该方法内得到任何控制
请帮帮我,
谢谢
Dileep
The above codes are working properly. But when i put some code for bind the Grid in the "ShowBooked_Items" method, but i didn''t get the grid in that method . I didn''t get any control inside that method
Please Help me,
Thanks
Dileep
正如 Christian Graus 告诉您通过json传递数据来绑定datagird一样,您可以引用 ^ ]文章.可能会对您有帮助.
没有回发,您将无法从后面的代码中绑定数据网格.唯一的方法是使用json更新您的网格信息,或者您可以使用更新"面板来避免页面刷新.
希望以上文章对您有帮助,
谢谢
-Amit Gajjar
Hi,
As Christian Graus told you to pass your data through json to bind your datagird, you can refer this[^] article. it may help you.
Without postback you can not bind your datagrid from code behind. the only way is to update your grid information using json or may be you can use Update panel so you will not feel page refresh.
Hope above article helps you,
Thanks
-Amit Gajjar
这篇关于我没有将控件放入方法中.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!