Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ItemCommand event does not fire???

Reply
Thread Tools

ItemCommand event does not fire???

 
 
Jimmy
Guest
Posts: n/a
 
      05-27-2005
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


 
Reply With Quote
 
 
 
 
Bruce Barker
Guest
Posts: n/a
 
      05-27-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
vMike
Guest
Posts: n/a
 
      05-27-2005

"Jimmy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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!


 
Reply With Quote
 
Jimmy
Guest
Posts: n/a
 
      05-28-2005
thanks guys
I got it:
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwebuiwebcontrolsrepeaterclassonitemcomm andtopic.asp

"Jimmy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ImageButton does not trigger Repeater.ItemCommand event Nathan Sokalski ASP .Net Web Controls 2 11-17-2007 03:03 AM
ImageButton does not trigger Repeater.ItemCommand event Nathan Sokalski ASP .Net 2 11-17-2007 03:03 AM
Event Bubbling and the ItemCommand Event Nathan Sokalski ASP .Net 0 05-29-2006 07:16 AM
Bug in DataGrid - ItemCommand event does not fire for ButtonColumnif ButtonType="PushButton" Nick Gilbert ASP .Net Datagrid Control 4 12-16-2003 06:39 AM
Bug in DataGrid - ItemCommand event does not fire for ButtonColumnif ButtonType="PushButton" Nick Gilbert ASP .Net 2 12-15-2003 08:10 AM



Advertisments