在datalist的ItemDataBound里将RadioButtonList逐个找个来绑上事件

解决方案 »

  1.   

    我在datalist的ItemDataBound事件里已经写了一些别的代码,
    能详细一点说明一下绑定事件的过程吗
      

  2.   

    用findcontrol来找到此控件然后进行操做。
      

  3.   

    private void DataList1_ItemCreated(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
    {
    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    {
    RadioButtonList1  = (RadioButtonList)e.Item.FindControl("RadioButtonList1");
    RadioButtonList1.SelectedIndexChanged += new System.EventHandler(DataList1_SelectedIndexChanged);
    } }