Binding OnitemCommand event

5 posts, 0 answers
  1. Raju Kumar
    Raju Kumar avatar
    15 posts
    Member since:
    May 2008

    Posted 14 May 2008 Link to this post

    Hi,
     I need to invoke

    OnItemCommand

     event on a click of a Image button under  <telerik:GridTemplateColumn>

    I am able to do so on Linkbutton but not with Image button.

    My code is this.


    <

    telerik:GridTemplateColumn UniqueName="TemplateColumnDelete" Groupable="False">

    <HeaderStyle Width="45px"></HeaderStyle>

    <ItemTemplate>

    <asp:LinkButton ID="lnkButtonDelete" runat="server" CommandName="Delete" Text="delete"></asp:LinkButton>

    <!-- <asp:ImageButton ID="imgButtonDel" ImageUrl="~/Images/bt_delete.gif" runat="server"

    CommandName="Delete"></asp:ImageButton>-->

    </ItemTemplate>

    </telerik:GridTemplateColumn>


    Thanks.
    Raju.

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 May 2008 Link to this post

    Hi Raju,

    Are you checking the proper CommandName in the ItemCommand event? I was able to achieve this on my end. My code is as follows.

    ASPX:
    <telerik:GridTemplateColumn HeaderText="Temp" UniqueName="Temp" > 
                               <ItemTemplate> 
                                   <asp:ImageButton ID="ImageButton1" CommandName="Delete"   ImageUrl="~/image1.gif"  runat="server"  /> 
                                 
                               </ItemTemplate> 
                              </telerik:GridTemplateColumn> 


    CS:
     protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
        { 
            if (e.CommandName == "Delete") 
            {  
             
            } 
       } 


    Thanks
    Shinu.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Raju Kumar
    Raju Kumar avatar
    15 posts
    Member since:
    May 2008

    Posted 14 May 2008 Link to this post

    Hi Shinu,
           I am still not able to solve my problem, I am doing the same thing what you have written, actually the problem is that, it is able to bind ItemCommand event on click of a link button but when i use Image Button the ItemCommand event is not occur. Can you please tell me the exact reason for this.

    My code is like in ASPX

    <

    telerik:RadGrid

    OnItemCommand

    ="InHouseRadGrid_ItemCommand"

     .......>

    <MasterTableView Width="100%" AllowMultiColumnSorting="True">

    <Columns>

    <telerik:GridTemplateColumn UniqueName="TemplateColumnDelete" Groupable="False">

    <HeaderStyle Width="45px"></HeaderStyle>

    <ItemTemplate>

     <asp:ImageButton ID="imgButtonDel" ImageUrl="~/Images/bt_delete.gif" runat="server"

    CommandName="Delete"></asp:ImageButton>

    </ItemTemplate>

    </telerik:GridTemplateColumn>

     </Columns>

    </

    MasterTableView>

    </telerik:RadGrid>


    And on c#

    protected

    void InHouseRadGrid_ItemCommand(object source, GridCommandEventArgs e)

    {

    }

    NOTE::  The debugger is not coming on this event.
     

  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 May 2008 Link to this post

    Hi Raju,

    Have you set the Event Handler for the ItemCommand event in the aspx?

    ASPX:
     <telerik:RadGrid ID="RadGrid1"    runat="server"   OnItemCommand="RadGrid1_ItemCommand"  > 


    Thanks
    Shinu.
  6. mamad
    mamad avatar
    14 posts
    Member since:
    Apr 2007

    Posted 23 May 2010 Link to this post

    i have the same problem with image button in radgrid
    when i used imagebutton the item command event not occur
    but when i used link button or button the event occur true
    please help me solve this problem
    thank's
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017