问大家个事 怎么样可以遍历一下 本页面的所有控件
我就是 想得到 本页面的所有控件
用什么方法 谁告诉我下哈 谢谢
问题点数:0、回复次数:14Top
1 楼fanyp2006(默读忧伤)回复于 2006-03-04 15:45:57 得分 0
upTop
2 楼czhenq(...... fucking life. I want to change.)回复于 2006-03-04 15:55:53 得分 0
循环遍历Page.Controls以及其子控件Top
3 楼fanyp2006(默读忧伤)回复于 2006-03-04 15:58:02 得分 0
Page.Controls.GetEnumerator ???
以前没用过枚举 不会使正看查资料中......Top
4 楼fanyp2006(默读忧伤)回复于 2006-03-04 16:00:13 得分 0
呵呵~ msdn上 找到了
谢谢
Top
5 楼IFocusYou(易寒)回复于 2006-03-04 16:05:07 得分 0
Request.Form.AllKeysTop
6 楼IFocusYou(易寒)回复于 2006-03-04 16:06:13 得分 0
NameValueCollection coll = Request.Form;
String[] arr1 = coll.AllKeys;
string tempStr;
for (int i=0;i<arr1.Length;i++ )
{
tempStr = arr1[i];
}Top
7 楼fanyp2006(默读忧伤)回复于 2006-03-04 16:09:57 得分 0
Request.Form.AllKeys
这个 得到的是个数组吧
Top
8 楼fanyp2006(默读忧伤)回复于 2006-03-04 16:16:13 得分 0
易寒 你用的那个NameValueCollection coll 那里声明的
如果要是这样写 拿不到东西
String[] arr1 = Request.Form.AllKeys;
string tempStr;
for (int i=0;i<arr1.Length;i++ )
{
tempStr = arr1[i];
}
Top
9 楼xiahouwen(武眉博<活靶子.NET>)回复于 2006-03-04 16:18:49 得分 0
void DisplayAllTextBoxText(Control c)
{
if (c.Controls.Count > 0)
{
foreach (Control cc in c.Controls)
{
DisplayAllTextBoxText(cc);
}
}
Response.Write(c.ID.ToString());
}
DisplayText(Page); //or DisplayText(YourFormID);
Top
10 楼xiahouwen(武眉博<活靶子.NET>)回复于 2006-03-04 16:19:32 得分 0
http://www.aspxboy.com/private/showthread.asp?threadid=262Top
11 楼fanyp2006(默读忧伤)回复于 2006-03-04 16:24:42 得分 0
谢过楼上的Top
12 楼fanyp2006(默读忧伤)回复于 2006-03-04 16:33:35 得分 0
好像不能用
Top
13 楼jyk(今天由我来写的代码,明天就让程序自己完成!喜欢编程。和气生财。共同提高。共同进步!)回复于 2006-03-05 10:05:35 得分 0
Page.Controls[0]
Page.Controls[1]
Page.Controls[2]
Page.Controls[3]
Page.Controls[4]
Page.Controls[5]
......
Top
14 楼lym1314(一枝梅)回复于 2006-03-05 10:18:17 得分 0
学习
帮顶Top




