OnItemCommand in DataGrid

Discussion in 'ASP .Net Web Controls' started by vijay, Mar 2, 2004.

  1. vijay

    vijay Guest

    Hi all
    I am using a datagrid in my aspx page. and i have some coulums which contains push buttons. i want to handle click events on these buttons. OnItemCommand is only working for link buttons. please help
    regards
    vijay.
     
    vijay, Mar 2, 2004
    #1
    1. Advertising

  2. vijay

    Teemu Keiski Guest

    Hi,

    can you clarify how does it work only for LinkButtons? Do you have normal
    buttons with CommandName as well?

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist


    "vijay" <> wrote in message
    news:...
    > Hi all,
    > I am using a datagrid in my aspx page. and i have some coulums which

    contains push buttons. i want to handle click events on these buttons.
    OnItemCommand is only working for link buttons. please help.
    > regards,
    > vijay.
     
    Teemu Keiski, Mar 2, 2004
    #2
    1. Advertising

  3. vijay

    sayee vijay Guest

    Teemu Keiski,
    <asp:Repeater id="Repeater1" OnItemCommand="CommandEvent"
    runat="server"> <HeaderTemplate> <table> </HeaderTemplate>
    <ItemTemplate>
    <tr> <td>
    <asp:Image Height=100 Width=100 ImageUrl='<%#
    DataBinder.Eval(Container.DataItem,"vImagePath", "images{0}")%>'
    Runat=server>
    </asp:Image> </td>
    <td>
    <%#DataBinder.Eval(Container.DataItem,"vname")%>
    </td>
    <td>
    <asp:Button Text='<%# DataBinder.Eval(Container.DataItem,"imovieid")%>'
    CommandName="Add" Runat=server> </asp:Button> </td>
    </tr>
    </ItemTemplate>
    <FooterTemplate>
    </table>
    </FooterTemplate>
    </asp:Repeater>


    In the above code i have place a button control [not a bound column],
    and i have also implemented OnItemCommand event. When i press the button
    "CommandEvent" [OnItemCommand event handler] function is not fired. But
    when i replace the Button control to LinkButton "CommandEvent" function
    is fired.

    regards,
    vijay

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    sayee vijay, Mar 2, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick White
    Replies:
    1
    Views:
    1,635
    Natty Gur
    Jan 13, 2004
  2. LeAnne
    Replies:
    0
    Views:
    1,119
    LeAnne
    May 14, 2006
  3. Steve Hershoff
    Replies:
    0
    Views:
    420
    Steve Hershoff
    Aug 9, 2006
  4. Sonal

    datagrid onitemcommand not firing

    Sonal, Oct 29, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    175
    Sushila [MVP]
    Oct 30, 2004
  5. Datagrid EnableViewState OnItemCommand Problems

    , Jun 11, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    159
Loading...

Share This Page