//下拉dorpdownlist时
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = null;
foreach (RepeaterItem item in Repeater1.Controls)
{
if (item.ItemType == ListItemType.Header)
{
ddl = ((DropDownList)item.FindControl("Ddlshowtype"));
break;
}
}
int showtypeid = Convert.ToInt32(ddl.SelectedValue);
ViewState["showtypeid"] = showtypeid;
Bindrepeater(Convert.ToInt32(ViewState["showid"]), showtypeid);
}
//必须在这里绑定,不然非常麻烦
protected void Repeater1_ItemCreated(object sender, RepeaterItemEventArgs e)
{
int showid = Convert.ToInt32(ViewState["showid"]);
int showtypeid = Convert.ToInt32(ViewState["showtypeid"]);
if (e.Item.ItemType == ListItemType.Header)
{
Showprod sp = new Showprod();
if (showtypeid > 0)
{
((Literal)e.Item.FindControl("Ltnow")).Text = sp.SelsByShowtypeid(showtypeid).Count.ToString();
((Literal)e.Item.FindControl("Ltall")).Text = sp.SelsByShowid(showid).Count.ToString();
}
else
{
((Literal)e.Item.FindControl("Ltnow")).Text = sp.SelsByShowid(showid).Count.ToString();
((Literal)e.Item.FindControl("Ltall")).Text = sp.SelsByShowid(showid).Count.ToString();
}
Showtype st = new Showtype();
IList<ShowtypeInfo> isti = st.Sels(showid);
DropDownList ddl = (DropDownList)e.Item.FindControl("Ddlshowtype");
for (int i = 0; i < isti.Count; i++)
{
ddl.Items.Insert(i, new ListItem(isti[i].Showtypename.ToString(), isti[i].Showtypeid.ToString()));
if (isti[i].Showtypeid == Convert.ToInt32(ViewState["showtypeid"]))
{
ddl.Items[i].Selected = true;
}
}
ddl.Items.Insert(0, new ListItem("显示全部全部主题", "0"));
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = null;
foreach (RepeaterItem item in Repeater1.Controls)
{
if (item.ItemType == ListItemType.Header)
{
ddl = ((DropDownList)item.FindControl("Ddlshowtype"));
break;
}
}
int showtypeid = Convert.ToInt32(ddl.SelectedValue);
ViewState["showtypeid"] = showtypeid;
Bindrepeater(Convert.ToInt32(ViewState["showid"]), showtypeid);
}
//必须在这里绑定,不然非常麻烦
protected void Repeater1_ItemCreated(object sender, RepeaterItemEventArgs e)
{
int showid = Convert.ToInt32(ViewState["showid"]);
int showtypeid = Convert.ToInt32(ViewState["showtypeid"]);
if (e.Item.ItemType == ListItemType.Header)
{
Showprod sp = new Showprod();
if (showtypeid > 0)
{
((Literal)e.Item.FindControl("Ltnow")).Text = sp.SelsByShowtypeid(showtypeid).Count.ToString();
((Literal)e.Item.FindControl("Ltall")).Text = sp.SelsByShowid(showid).Count.ToString();
}
else
{
((Literal)e.Item.FindControl("Ltnow")).Text = sp.SelsByShowid(showid).Count.ToString();
((Literal)e.Item.FindControl("Ltall")).Text = sp.SelsByShowid(showid).Count.ToString();
}
Showtype st = new Showtype();
IList<ShowtypeInfo> isti = st.Sels(showid);
DropDownList ddl = (DropDownList)e.Item.FindControl("Ddlshowtype");
for (int i = 0; i < isti.Count; i++)
{
ddl.Items.Insert(i, new ListItem(isti[i].Showtypename.ToString(), isti[i].Showtypeid.ToString()));
if (isti[i].Showtypeid == Convert.ToInt32(ViewState["showtypeid"]))
{
ddl.Items[i].Selected = true;
}
}
ddl.Items.Insert(0, new ListItem("显示全部全部主题", "0"));
}