This is a migrated thread and some comments may be shown as answers.

Cannot trigger event from inside itemtemplate

2 Answers 73 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Jeppe
Top achievements
Rank 1
Jeppe asked on 20 Mar 2009, 04:42 AM
Hi

Im trying to fire an ItemCommand inside a RadGrid. But nothing happens.  I added a GridButtonColumn just for testing and when i press this one it does fire the event. Only the elements inside   <tel:GridTemplateColumn><ItemTemplate> does not work.

 <tel:RadGrid ID="ShoppingCardRadGrid" runat="server" AutoGenerateColumns="false" 
                OnItemCommand="ShoppingCardRadGrid_ItemCommand"  
                OnItemDataBound="ShoppingCardRadGrid_ItemDataBound" 
                EnableEmbeddedSkins="False" CssClass="tableDesign" ImagesPath="../images/generic/buttons/Grid"
                <FooterStyle HorizontalAlign="Center" /> 
                <AlternatingItemStyle BackColor="#FDF2F2" /> 
                <PagerStyle PagerTextFormat="" NextPageImageUrl="../images/generic/buttons/radGridForward.gif" 
                    PrevPageImageUrl="../images/generic/buttons/radGridBackwards.gif" HorizontalAlign="Center" /> 
                <MasterTableView NoMasterRecordsText="Your shopping cart is empty" ShowFooter="true"
                    <Columns>

then I have these 3 buttons. Only the last one fires the event.
  <tel:GridTemplateColumn> 
                            <ItemTemplate> 
                                <asp:LinkButton runat="server" ID="btnRemove" Text="Remove" CommandName="Remove" 
                                    CommandArgument='<%# Eval ("TicketId") %>'></asp:LinkButton> 
                            </ItemTemplate> 
                        </tel:GridTemplateColumn> 
                        <tel:GridTemplateColumn> 
                            <ItemTemplate> 
                                <asp:Button ID="Button1" runat="server" Text="Button" CommandName="Remove"/> 
                            </ItemTemplate> 
                        </tel:GridTemplateColumn>                                        
                       <tel:GridButtonColumn ButtonType="PushButton" CommandName="ThisDoesTriger"></tel:GridButtonColumn> 


2 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 20 Mar 2009, 06:24 AM
Hello Jeppe,

I am afraid that I was not able to replicate this issue on my end.
For your convenience I am sending you sample application which demonstrates that LinkButton Command fires ItemCommand event on RadGrid.

Sincerely yours,
Nikolay
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jeppe
Top achievements
Rank 1
answered on 21 Mar 2009, 02:27 AM
I found the problem. These buttons were causing a validation to happen on some input fields on the page.


Tags
Ajax
Asked by
Jeppe
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Jeppe
Top achievements
Rank 1
Share this question
or