还是drowdownlist问题
我在repeater加了一个drowdownlist!希望通过这个控件控制repeater中显示的数据!我的代码是protected void ddl_textchanged(object sender, EventArgs e)
{
foreach (RepeaterItem item in Repeater1.Items)
{
DropDownList ddl = (DropDownList)item.FindControl("DrowDownList1");
if (ddl.SelectedValue == "全部主题")
{
GetData();
}
else
{
model m = new model();
m.MsgType = ddl.SelectedValue;
m.U_Id = Session["UserId"].ToString();
Repeater1.DataSource = Bll.GetAllMsgFromTypeAndUserId(m);
Repeater1.DataBind();
}
}
}
请问,这代码有错吗?请高手们指点
------解决方案--------------------
ddl是放repeater内部还是外部了
想控制repeater的数据 应该是放外面
C# code
protected void ddl_textchanged(object sender, EventArgs e)
{
if (DrowDownList1.SelectedValue == "全部主题")
{
GetData();
}
else
{
model m = new model();
m.MsgType = DrowDownList1.SelectedValue;
m.U_Id = Session["UserId"].ToString();
Repeater1.DataSource = Bll.GetAllMsgFromTypeAndUserId(m);
Repeater1.DataBind();
}
}