本人自学所以基础很差- -~~

解决方案 »

  1.   

    先在gridview中findcontrol(),找到这个RadioButtonList控件,然后强制转换成RadioButtonList。就跟一般的RadioButtonList一样的用了。
      

  2.   

    额你有没有绑定DataList的- -~~
      

  3.   

    Refer:http://www.cnblogs.com/insus/archive/2013/05/07/3064844.html
      

  4.   

    View Code private List<Survey> SurveyData()
        {
            List<Survey> s = new List<Survey>();
            s.Add(new Survey("1.1", "title 1"));
            s.Add(new Survey("1.2", "title 1"));
            s.Add(new Survey("1.3", "title 1"));
            return s;
        }这里是放在类里还是放在~新建的aspx里?- -刚刚入门问的问题有点内阁个~但是还是希望你能教教
      

  5.   

    protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    DataTable dt = new DataTable();
                    dt.Columns.AddRange(new DataColumn[] { 
                        new DataColumn("name",typeof(string)),
                        new DataColumn("age",typeof(string))
                    });                DataRow dr = null;                dr = dt.NewRow();
                    dr["name"] = "guwei";
                    dr["age"] = "30";
                    dt.Rows.Add(dr);                dr = dt.NewRow();
                    dr["name"] = "google";
                    dr["age"] = "28";
                    dt.Rows.Add(dr);                this.DataList1.DataSource = dt;
                    this.DataList1.DataBind();
                }
            }        protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
            {
                RadioButtonList radioButtonList = e.Item.FindControl("RadioButtonList1") as RadioButtonList;
            }        protected void Button1_Click(object sender, EventArgs e)
            {
                foreach (DataListItem item in DataList1.Items)
                {
                    RadioButtonList radioButtonList = item.FindControl("RadioButtonList1") as RadioButtonList;
                    string value = radioButtonList.SelectedValue;
                }        }<body>
        <form id="form1" runat="server">
        <div>
            <asp:DataList ID="DataList1" runat="server" 
                onitemdatabound="DataList1_ItemDataBound">
                <ItemTemplate>
                    <asp:RadioButtonList ID="RadioButtonList1" runat="server">
                        <asp:ListItem Text="1" Value="1" />
                        <asp:ListItem Text="2" Value="2" />
                        <asp:ListItem Text="3" Value="3" />
                    </asp:RadioButtonList>
                </ItemTemplate>
            </asp:DataList>
        </div>
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        </form>
    </body>
      

  6.   

    RadioButtonList rbl=(RadioButtonList)你的数据控件名称.rows[行号].findcontrol("你的radiolist名称")这样就获取到某一行的单选按钮了。获取这里面的值也是很简单的跟普通的一样方式
      

  7.   

    页面应该看得懂吧,后台注释如下:
    protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    //初始化一个Datatable
                    DataTable dt = new DataTable();
                    dt.Columns.AddRange(new DataColumn[] { 
                        new DataColumn("name",typeof(string)),
                        new DataColumn("age",typeof(string))
                    });                DataRow dr = null;                dr = dt.NewRow();
                    dr["name"] = "guwei";
                    dr["age"] = "30";
                    dt.Rows.Add(dr);                dr = dt.NewRow();
                    dr["name"] = "google";
                    dr["age"] = "28";
                    dt.Rows.Add(dr);                //DataList绑定这个Datatable
                    this.DataList1.DataSource = dt;
                    this.DataList1.DataBind();
                }
            }        //这个而是DataList1控件的ItemDataBound事件
            protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
            {
                //这里可以在DataList1绑定后,获取每一个RadioButtonList
                RadioButtonList radioButtonList = e.Item.FindControl("RadioButtonList1") as RadioButtonList;
            }        //这里是一个按钮,随意点击遍历这个DataList1的Item,来获取所选的值
            protected void Button1_Click(object sender, EventArgs e)
            {
                foreach (DataListItem item in DataList1.Items)
                {
                    RadioButtonList radioButtonList = item.FindControl("RadioButtonList1") as RadioButtonList;
                    string value = radioButtonList.SelectedValue;
                }        }
      

  8.   

    我有个问题能给个建议么~~?我在做一个在线考试的东西 ~学生端的~~你说用RadioButton好还是RadioButtonList好
      

  9.   

    每一道题答案都有:ABCD四个选项,还是用RadioButton好用。当然RadioButton也一样用就是了。
      

  10.   

    以前都没接触过这种~~以前都是直接用DataList或者GridView做添加修改删除~~现在第一次接触这种- -所以不知道什么下手
      

  11.   

    每一道题答案都有:ABCD四个选项,还是用RadioButton好用。当然RadioButton也一样用就是了。恩~用RadioButton 我知道用循环快~但是不知道什么下手~所以每个RadioButton 都要写一段代码