TeaAddictedGeek
Programmer
Here's what I have:
I am attempting to toggle back and forth between two image buttons as far as their visibility is concerned. Each should be firing an event within a Repeater to toggle one to visible and the other to not:
<asp:ImageButton
runat="server"
ID="btnCollapse"
CommandName="Collapse"
ImageUrl="images/Collapse.gif"
Visible = "true"/>
<asp:ImageButton
runat="server"
ID="btnExpand"
CommandName="Expand"
ImageUrl="images/Expand.gif"
Visible="false" />
Here's the C# code:
protected void rtASAP_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "Collapse")
{
((ImageButton)this.rtASAP.FindControl("btnCollapse")).Visible = false;
((ImageButton)this.rtASAP.FindControl("btnExpand")).Visible = true;
}
else
{
if (e.CommandName == "Expand")
{
((ImageButton)this.rtASAP.FindControl("btnCollapse")).Visible = true;
((ImageButton)this.rtASAP.FindControl("btnExpand")).Visible = false;
}
}
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.rtASAP.ItemDataBound += new RepeaterItemEventHandler(this.rtASAP_ItemDataBound);
this.rtASAP.ItemCommand += new RepeaterCommandEventHandler(this.rtASAP_ItemCommand);
this.Load += new System.EventHandler(this.Page_Load);
}
So far it is completely ignoring the ItemCommand event and I've tried putting a breakpoint in there to see if it is accessing ANY code--no dice.
Any ideas on what's wrong here?
Thanks in advance!
"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum
I am attempting to toggle back and forth between two image buttons as far as their visibility is concerned. Each should be firing an event within a Repeater to toggle one to visible and the other to not:
<asp:ImageButton
runat="server"
ID="btnCollapse"
CommandName="Collapse"
ImageUrl="images/Collapse.gif"
Visible = "true"/>
<asp:ImageButton
runat="server"
ID="btnExpand"
CommandName="Expand"
ImageUrl="images/Expand.gif"
Visible="false" />
Here's the C# code:
protected void rtASAP_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "Collapse")
{
((ImageButton)this.rtASAP.FindControl("btnCollapse")).Visible = false;
((ImageButton)this.rtASAP.FindControl("btnExpand")).Visible = true;
}
else
{
if (e.CommandName == "Expand")
{
((ImageButton)this.rtASAP.FindControl("btnCollapse")).Visible = true;
((ImageButton)this.rtASAP.FindControl("btnExpand")).Visible = false;
}
}
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.rtASAP.ItemDataBound += new RepeaterItemEventHandler(this.rtASAP_ItemDataBound);
this.rtASAP.ItemCommand += new RepeaterCommandEventHandler(this.rtASAP_ItemCommand);
this.Load += new System.EventHandler(this.Page_Load);
}
So far it is completely ignoring the ItemCommand event and I've tried putting a breakpoint in there to see if it is accessing ANY code--no dice.
Any ideas on what's wrong here?
Thanks in advance!
"The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs."
-Joseph Weizenbaum