ItemCommand event does not fire???

J

Jimmy

Hi,

I built a webform with a repeater:

<asp:repeater id="rep1" runat="server" DataSource='<%# ar %>'>
<ItemTemplate>
<asp:Button Runat=server Text="<%# Container.DataItem %>" ID="Button1"
NAME="Button1"/>
</ItemTemplate>
</asp:repeater>

in my code behind the webform I have
-an array ar (which is not the problem here)
-the ItemCommand event, which does not fire???:
private void rep1_ItemCommand(object source,
System.Web.UI.WebControls.RepeaterCommandEventArgs e)

{

//some code

}



If I try a asp:LinkButton instead of a asp:Button it DOES fire!!! So the
question is why does this event not fire in case of the aspbutton??? You
should be able to fire a button right???



thanks



JIM
 
B

Bruce Barker

buttons don't support the ItemCommand event, because they do not use
javascript to postback, so the ItemCommand hidden fields are not filled in.

-- bruce (sqlwork.com)
 
V

vMike

Jimmy said:
Hi,

I built a webform with a repeater:

<asp:repeater id="rep1" runat="server" DataSource='<%# ar %>'>
<ItemTemplate>
<asp:Button Runat=server Text="<%# Container.DataItem %>" ID="Button1"
NAME="Button1"/>
</ItemTemplate>
</asp:repeater>

in my code behind the webform I have
-an array ar (which is not the problem here)
-the ItemCommand event, which does not fire???:
private void rep1_ItemCommand(object source,
System.Web.UI.WebControls.RepeaterCommandEventArgs e)

{

//some code

}



If I try a asp:LinkButton instead of a asp:Button it DOES fire!!! So the
question is why does this event not fire in case of the aspbutton??? You
should be able to fire a button right???



thanks



JIM
I didn't see OnItemCommand="rep1_ItemCommand" in your repeater tagss!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top