repeater中如何对RadioButtonList进行数据绑定

来源:百度知道 编辑:UC知道 时间:2024/07/07 18:15:06
在repeater中有一个RadioButtonList,有4个选项,现在想对每一个选项进行数据绑定,不支持<%#Eval("a")%>的方式啊,我的数据从数据库取出来是用的IList类型保存的一个list,请问如何绑定上去啊
一定要用IList的,我现在是把IList绑定给了repeater的,<%#Eval("a")%>不行啊

非要用IList类型保存吗
如果不是的话
那你就用DataSet来保存从数据库中读取的信息
然后把repeater的DataSource绑定这个DataSet后
就可以用<%#Eval("a")%>来对repeater里的RadioButtonList进行数据绑定了

------------------------------------------------------------------
那你在repeater的ItemDataBound事件里写
RadioButtonList rbl = (RadioButtonList)e.Item.FindControl("a");//RadioButtonList的ID
rbl.DataSource=list;//你绑定的list
rbl.DataBind();