使用Page.Controls访问页面中的控件 [英] Accessing controls in the page with Page.Controls

查看:51
本文介绍了使用Page.Controls访问页面中的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我有一个关于使用Page.Controls访问页面控件的问题。

我们可以通过ID以这种方式访问​​控件吗? div class =h2_lin>解决方案

是的,我们可以。使用 Control.FindControl Method(String) [ ^ ]。

  //  在页面上查找控件。 
控制myControl1 = FindControl( TextBox2);


Hi everybody.
I had a question about accessing controls in the page with Page.Controls.
Could we access a control in this way by the ID?

解决方案

Yes we can. Use Control.FindControl Method (String)[^].

// Find control on page.
Control myControl1 = FindControl("TextBox2");


这篇关于使用Page.Controls访问页面中的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆