在做一个答题的程序,答题页面有分组,分组内有该分组的题目,题目内有该题目的选项;都是使用Repeater空间来实现。现在可以绑定分组和题目的数据源,怎么样绑定选项的信息?谢谢、、

解决方案 »

  1.   

    基础问题要自己动手做的findcontrol()然后绑定具体自己试下了
      

  2.   

    终于解决了,当时做的时候想太多了,其实挺简单的,        //绑定分组信息
            repGroupList.DataSource = GroupManager.GetGroupList(qnId);
            repGroupList.DataBind();    //绑定分组信息时,绑定题目信息
        protected void repGroupList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Group group = (Group)e.Item.DataItem;            Repeater repQuestionList = (Repeater)e.Item.FindControl("repQuestionList");
                repQuestionList.DataSource = QuestionManager.GetQuestionListByGroupId(group.GroupId);
                repQuestionList.DataBind();
            }
        }    //绑定题目信息时,绑定选项信息
        protected void repQuestionList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                Question question = (Question)e.Item.DataItem;            Repeater repOptionList = (Repeater)e.Item.FindControl("repOptionList");
                repOptionList.DataSource = OptionManager.GetOptionsByQId(question.QId);
                repOptionList.DataBind();
            }
        }