标题:動態控件取值的問題
只看楼主
xunmi_love
Rank: 2
等 级:论坛游民
帖 子:204
专家分:18
注 册:2006-10-14
结帖率:57.14%
 问题点数:0 回复次数:1 
動態控件取值的問題
取不到控件的值,
這個可能是加載時的問題,但是用了ispostback,也沒有用。
不清楚是怎麼樣一個問題了。
請過路的大仙們指點一下,感謝人世分!
protected void tbnclick()
    {
        string jiZhong = TextBox1.Text;
        string[] arrJZ = jiZhong.Split(',');
        int jiZhongShu = arrJZ.Length;
        for (int i = 0; i < jiZhongShu; i++)
        {
            Table tab = new Table();
            tab.ID = "tab" + i.ToString();
            for (int b = 0; b < 4; b++)
            {
                string tr = "";
                switch (b)
                {
                    case 0:
                        tr = "first";
                        break;
                    case 1:
                        tr = "second";
                        break;
                    case 2:
                        tr = "three";
                        break;
                    case 3:
                        tr = "four";
                        break;
                }
                TableRow tabr = new TableRow();
                for (int r = 0; r < 2; r++)
                {
                    TableCell tabc = new TableCell();
                    TextBox tb = new TextBox();
                    tb.ID = tr + "td" + i.ToString();
                    TableCell tabc1 = new TableCell();
                    tabc1.Text = tr;
                    tabc.Controls.Add(tb);
                    tabr.Cells.Add(tabc);
                    tabr.Cells.Add(tabc1);
                }
                tab.Controls.Add(tabr);
            }
            this.Panel1.Controls.Add(tab);
        }
搜索更多相关主题的帖子: 控件 
2010-07-29 18:32
xunmi_love
Rank: 2
等 级:论坛游民
帖 子:204
专家分:18
注 册:2006-10-14
得分:0 
大家幫幫忙,別只看不頂,
路過的朋友也幫頂一下!

低頭做人,擡頭做事。
2010-07-30 08:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-314318-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.242745 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved