所属书库 | 状态 |
---|---|
三级书库 | 设置过关积分 |
皮皮鲁传---积分:50 (选读) | |
三国演义---积分:50 (必读) | |
四级书库 | 设置过关积分 |
小王子---积分:50 (必读) | |
格列佛游记---积分:50 (必读) | |
五级书库 | 设置过关积分 |
六级书库 | 设置过关积分 |
七级书库 |
static Repeater trpt = null;
static Button tbtn = null;
protected void rptResultsList_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "show")
{
if (tbtn != null && trpt != null)
{
if (tbtn.Text == "▼")
{
tbtn.Text = "▲";
trpt.DataSource = string.Empty;
trpt.DataBind();
}
}
UserIdentity identity=User.Identity as UserIdentity;
if(identity != null)
{
DataSet ds = Exam.BLL.tb_School_QuestionClsBLL.GetInstance().Get_School_QuestionClsRelationIdBySchoolId(identity._schoolID,int.Parse(e.CommandArgument.ToString()));
if (ds != null)
{
Button btn = e.Item.FindControl("btn") as Button;
Repeater rpt = e.Item.FindControl("rptResults2") as Repeater;
tbtn = btn;
trpt = rpt;
if (btn.Text == "▲")
{
btn.Text = "▼";
rpt.DataSource = ds;
rpt.DataBind();
}
else
{
btn.Text = "▲";
rpt.DataSource = string.Empty;
rpt.DataBind();
}
}
}
}
}
这样做为何没能实现
直接用Visable属性吧。
关键不在这,多个repeater当中找到上一次点击的控件才是关键,但我已经找到了可是不管用啊if (tbtn != null && trpt != null)
{
if (tbtn.Text == "▼")
{
tbtn.Text = "▲";
trpt.DataSource = string.Empty;
trpt.DataBind();
}
}