现在我要根据数据库表中的某一列来产生Radio,执行查找语句后得到想要的数据。有一个就生成一个Radio。还有怎样把生成的Radio加入前台的ASPX页中相应的位置?
哪位大侠帮帮忙?

解决方案 »

  1.   

    前台<asp:Panel ID="Panel1" runat="server">
                    </asp:Panel>后台 (.cs文件)RadioButton rb = new RadioButton();
                rb.Text = "值";
                rb.ID = "id";
                Panel1.Controls.Add(rb);这应该是你想要的效果。
    但是你应该用
    RadioButtonList才对呀<asp:RadioButtonList ID="RadioButtonList1" runat="server">
                    </asp:RadioButtonList>
    for (int i=0; i<10; i++)
                {
                    RadioButtonList1.Items.Add(i.ToString());
                    RadioButtonList1.Items[i].Value = i.ToString();
                }
      

  2.   

    是的,贴发完才发现要用RadioButtonList,呵呵。非常感谢。