<asp:rediobutton>...</asp:radionbutton>是服务端控件,怎么能直接输出到客户端啊.要在服务端用代码加:private void Page_Load(object sender, System.EventArgs e)
{
RadioButtonList myRadioButtonList = new RadioButtonList();
myRadioButtonList.Items.Add("name");
this.Controls[1].Controls.Add(myRadioButtonList);
}

解决方案 »

  1.   

    动态添加for(int i=0;i<10;i++)
    {
       RadioButton _r=new RadioButton();
       _r.ID="radio"+i.ToString();
       this.Page.Controls.add(_r);
    }
      

  2.   

    Controls怎么解释,我是直接在我的叶面上面加入!可以认识么?
    我的MSN:[email protected]
      

  3.   

    Control 'radio0' of type 'RadioButton' must be placed inside a form tag with runat=server. 
    出现这样的错误怎么解释!
      

  4.   

    Controls是控件中包含的控件集合。
    按照我给的代码试一下
      

  5.   

    楼上的明显错了
    控件的大小,位置都没有
    怎么显示。
    同时你可以做个试验
    在.vb里面dim一个TextBox
    但是在ASPx里面没有
    那么你就会发现
    me.controls(0)里面有的
    但是页面上没有
      

  6.   

    解决方法有二种:
    1.利用RadioButtonList(推荐)
       在你要放RadioButton的地方放一个RadioButtonList,(假设ID=radList)
       动态增加:
       ListItem li=new ListItem("value","text");
       radList.Items.add(li);2.直接放RadioButtonList()
      在你要放RadioButton的地方随便放一个服务器控件
      如:<p id="p1" runat="server"></p>
       RadioButton rad=new RadioButton();
       rad.ID="rad1";
       rad.Value=....
       ....
       p1.Controls.add(rad);
      

  7.   

    如果直接在页面上加载控件的话
    如:this.Contorls.Add(..)
    这样会出错的,因为它把控件加载到</html>标志以外去了,所有会有
    must be placed inside a form tag with runat=server. 
    这样的错