By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,658 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,658 IT Pros & Developers. It's quick & easy.

ItemCommand event does not fire???

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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)
"Jimmy" <be****@gmail.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
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

Nov 19 '05 #2

P: n/a

"Jimmy" <be****@gmail.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
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!
Nov 19 '05 #3

P: n/a
thanks guys
I got it:
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwebuiwebcontrolsrepeaterclassonitemcomm andtopic.asp

"Jimmy" <be****@gmail.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
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

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.