查找页面中的控件 [英] Finding Controls in a Page
本文介绍了查找页面中的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试浏览页面中的所有控件,如果它是一个文本框然后使其不可编辑......我该怎么做...
I am trying to go through all controls in a page and if its a text box then making it non editable.... how do i go about it...
推荐答案
有像Page.Controls或Page.Components之类的东西。
循环查看它们是否属于文本框类型。
如果它们是,将它们标记为只读。
There is like a Page.Controls or Page.Components or something.
loop through them checking to see if they are of type textbox.
If they are, mark them as readonly.
我正在尝试做这样的事情......但是如果它是一个文本框,它们就没有选择匹配控件的位置....? ?
foreach(控制Page.Controls中的控件)
{
如果控制。 =文本框
{
}
}
I am trying to do something like this... but their is no option as where to match the control if its a text box....??
foreach (Controls control in Page.Controls)
{
if control.?? = textbox
{
}
}
应该像
展开 | 选择 | Wrap | 行号
这篇关于查找页面中的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文