RadioButtonList 如何绑定含 html 代码的数据?
问题如上,详细为需要动态绑定一个RadioButtonList控件的ListItem 项,ListItem 的TEXT为一个图片的html代码和一个数值组成,请问是否可以实现?
代码如下:
RadioButtonList rbl_Color = (RadioButtonList)e.Item.FindControl("rbl_Color");
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
rbl_Color.Items.Add(new ListItem("<img src=""+ ds.Tables[0].Rows[i]["picepath"].ToString() +"" width="20" height="20" />"+ ds.Tables[0].Rows[i]["colorsummary"].ToString(), ds.Tables[0].Rows[i]["colorsummary"].ToString()));
}