前台:
<%#Eval("大类的名称") %>
<%#Eval("小类的名称") %>
后台:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
public void bind()
{
Repeater1.DataSource = bv.GetVotesList();//获取大类表的所有信息
Repeater1.DataBind();
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
Repeater rpt = (Repeater)e.Item.FindControl("Repeater2");
HiddenField hf = (HiddenField)e.Item.FindControl("HiddenField1");
rpt.DataSource = bvc.GetOneVoteContentListById(int.Parse(hf.Value));//获取大类id对应的小类的列表
rpt.DataBind();
}
你这个是要用到嵌套Repeater的