<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);
}
{
RadioButtonList myRadioButtonList = new RadioButtonList();
myRadioButtonList.Items.Add("name");
this.Controls[1].Controls.Add(myRadioButtonList);
}
解决方案 »
- 如何给Radiobuttonlist 绑定数据
- 存储过程在 事务里循环的问题 急啊 在线等!!!!!!
- asp.net连接MySql数据库问题
- ORA-02041: client database did not begin a transaction
- 高手,我刚学.net没几天,我用登陆控件做了一个登陆,可是出现了错误,您抽空帮我指点一下,不胜感激,急
- checkbox selection
- 大家好,求正则表达式,字母数字组合或者电子邮箱
- 求一个ajax无刷新的分页控件在线等!!!!
- 有什么办法用javascript消去ie的菜单条和工具条?
- ASP.NET 中用PDF2SWF无法转换大于4M的PDF文件
- 我贴出DES解密代码,谁能写出相应的加密代码?
- 如何通过一个class设定HyperLink的text
{
RadioButton _r=new RadioButton();
_r.ID="radio"+i.ToString();
this.Page.Controls.add(_r);
}
我的MSN:[email protected]
出现这样的错误怎么解释!
按照我给的代码试一下
控件的大小,位置都没有
怎么显示。
同时你可以做个试验
在.vb里面dim一个TextBox
但是在ASPx里面没有
那么你就会发现
me.controls(0)里面有的
但是页面上没有
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);
如:this.Contorls.Add(..)
这样会出错的,因为它把控件加载到</html>标志以外去了,所有会有
must be placed inside a form tag with runat=server.
这样的错