TextBox tb = (TextBox)this.FindControl("txt" + 1);

解决方案 »

  1.   

    大哥,不要这么懒啊我也知道要
            textbox.Style.Item("LEFT") = 200
            textbox.Style.Item("TOP") = 200
    ---------------
    Me.FindControl("Form1").Controls.Add(textbox)
    但并不在我指定的位置呀,该怎样写呢?
      

  2.   

    利用panel,把动态生的控件装载进去
      

  3.   

    我这个页面是这样的
    要在表格中(单元格)显示数据
    但实际上数据是显示在textbox.text中的
    textbox定位在单元格上,这样就使数据看起来象在单元格中,实际是在
    textbox内,而且该行单元格是动态产生的,所以要textbox也动态产生和定位在单元格上,即使用panel,能实现嘛,panel不也得动态定位吗?
      

  4.   

    http://expert.csdn.net/Expert/topic/2146/2146645.xml?temp=.4301111
    参考这个网页,
    跟我问的问题差不多。
      

  5.   

    在页面上先放一个表MenuTable:
    for(int j =0;j<8;j++){
    TableRow r = new TableRow();
    int numcells = 4;
    for (int i=0; i<numcells; i++) 
    {
    TableCell c = new TableCell();
    c.HorizontalAlign = HorizontalAlign.Center;
    c.Height = (Unit)25;
    c.Font.Bold=true;
    c.Attributes.Add("onmouseover", "this.style.backgroundColor='LightGoldenrodYellow'");
    c.Attributes.Add("onmouseout", "this.style.backgroundColor='LightBlue'");
    c.Style["cursor"] = "hand";
    c.ForeColor=Color.Blue;
    TextBox tb =  new TextBox();
    tb.ID="dd";
    tb.Text="aa";
    c.Controls.Add(tb);
    r.Cells.Add(c);
    }
    MenuTable.Rows.Add(r);
    }
      

  6.   

    在你想放置控件的位置放上一个placeHolder
    使用placeHolder来加载控件
      

  7.   

    TableRow r = new TableRow();
    int numcells = 4;
    for (int i=0; i<numcells; i++) 
    {
    TableCell c = new TableCell();
    c.HorizontalAlign = HorizontalAlign.Center;
    c.Height = (Unit)25;
    c.Font.Bold=true;
    c.Attributes.Add("onmouseover", "this.style.backgroundColor='LightGoldenrodYellow'");
    c.Attributes.Add("onmouseout", "this.style.backgroundColor='LightBlue'");
    c.Style["cursor"] = "hand";
    c.ForeColor=Color.Blue;
    r.Cells.Add(c);
    }
    MenuTable.Rows.Add(r);
      

  8.   

    for(int j =0;j<8;j++){
    TableRow r = new TableRow();
    int numcells = 4;
    for (int i=0; i<numcells; i++) 
    {
    TableCell c = new TableCell();
    c.HorizontalAlign = HorizontalAlign.Center;
    c.Height = (Unit)25;
    c.Font.Bold=true;
    c.Attributes.Add("onmouseover", "this.style.backgroundColor='LightBlue'");
    c.Attributes.Add("onmouseout", "this.style.backgroundColor='White'");
    c.Style["cursor"] = "hand";
    c.ForeColor=Color.Blue;
    TextBox tb =  new TextBox();
    tb.ID="dd";
    if(i == 3)
    tb.Text="aa";
    if(i== 1)
    tb.Text="hh";
    else
    tb.Text="ui";
    c.Controls.Add(tb);
    r.Cells.Add(c);
    }
    MenuTable.Rows.Add(r);
    }
      

  9.   

    不好意思,加上
    textbox.Style.Item("POSITION") = "absolute"好象可以了,
    谢谢各位,帖子明天结
      

  10.   

    你可以放置一个TEXTBOX在通过VISABLE属性控制它的显示
      

  11.   

    各位,问题已解决,谢谢大家
    还有一个小问题,不想在开帖子了,给20分吧
    得到table1的TOP后(TOP=90px),怎样计算得到一个新的TOP呢(比如TOP再加10,新的TOP为100)
    table2.Style.Item("TOP")=table1.Style("TOP")+10//??????????
    在线关注
      

  12.   

    问题已解决
    "90PX"--->90
    System.Web.UI.WebControls.Unit.Parse(table1.Style("TOP")).Value