从Page Methods访问asp.net控件 [英] Accessing asp.net controls from Page Methods
本文介绍了从Page Methods访问asp.net控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
有没有办法从Page方法(网络方法)访问asp.net控件。我真的被困在ma项目中最后几周..祝福帮助我..
谢谢你的进步
Aatif Ali-Bangalore
Hi all,
is there any way to access asp.net controls from Page methods(web methods).i am really stuck ma project in last couple of weeks..pleas help me..
Thanks n Advnce
Aatif Ali-Bangalore
推荐答案
您好b $ b
是的,您可以在页面找到任何控件Page.FindControl
方法非常简单,只需按照链接获取更多信息:
http ://msdn.microsoft.com/en-us/library/31hxzsdw.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/486wc64h.aspx [ ^ ]
http://stackoverflow.com/questions/3157788/how-can-i-use-findcontrol-method-in-asp -net [ ^ ]
http://stackoverflow.com/questions/7362482/c-sharp-get-all-web-controls-on-page [ ^ ]
http://stackoverflow.com/questions/1224447/c-sharp-find-controls-and-control-reference [ ^ ]
在这里你可以找到一个递归方法这个目的;)
http:// stackoverflow .com / questions / 13336839 / asp-net-findcontrol-and-gridview-returning-null [ ^ ]
最好的问候。
Hi
Yes you can find any control in page withPage.FindControl
method really easily, just follow of links for get the more information:
http://msdn.microsoft.com/en-us/library/31hxzsdw.aspx[^]
http://msdn.microsoft.com/en-us/library/486wc64h.aspx[^]
http://stackoverflow.com/questions/3157788/how-can-i-use-findcontrol-method-in-asp-net[^]
http://stackoverflow.com/questions/7362482/c-sharp-get-all-web-controls-on-page[^]
http://stackoverflow.com/questions/1224447/c-sharp-find-controls-and-control-reference[^]
and here you can find a recursive method for this purpose ;)
http://stackoverflow.com/questions/13336839/asp-net-findcontrol-and-gridview-returning-null[^]
Best Regards.
var x=Page.FindControl("YourControlId");
例如:
for example:
var x=Page.FindControl("txtSample");
x.text="Sample text";
[edit]已添加代码块[/ edit]
[edit]Code block added[/edit]
这篇关于从Page Methods访问asp.net控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文