日期:2014-05-17  浏览次数:20411 次

在DataList里嵌套RadioButton如何取得RadioButton的值
我在DataList里放了四个RadioButton每个RadioButton都绑定了相应的数据. 当我运行的时候当点击RadioButton . RadioButton中的值就赋予相应的Label.  

------解决方案--------------------
参考:原文
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)  
{  
    if (e.Item.ItemType == ListItemType.Item 
------解决方案--------------------
 e.Item.ItemType == ListItemType.AlternatingItem)  
    {  
        Repeater repeater2 = e.Item.FindControl("Repeater2") as Repeater;  
        DataRowView rowv = (DataRowView)e.Item.DataItem;  
  
        string sfzh = Convert.ToString(rowv["sfzh"]);  
        DataRow[] rows = GetData().Tables[1].Select("sfzh='" + sfzh + "'");  
        DataTable dt = GetData().Tables[1].Clone();  
  
        foreach (DataRow dr in rows)  
        {  
            dt.ImportRow(dr);  
        }  
  
        repeater2.DataSource = dt;  
        repeater2.DataBind();  
    }  
}  

------解决方案--------------------
refer this:
http://www.cnblogs.com/insus/p/3193619.html
http://www.cnblogs.com/insus/p/3199341.html