datagrid buttoncolumn

Discussion in 'ASP .Net' started by Phil Townsend, Dec 30, 2004.

  1. I have placed a buttoncolumn into a datagrid, but it does not seem to
    raise any event when clicked. It should be firing the ItemCommand event,
    right? There is an appropriate event handler registered for the
    ItemCommand yet the button in the buttoncolumn does nothing wehn
    clicked. Any reasons why this might be happening? Thanks!



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Phil Townsend, Dec 30, 2004
    #1
    1. Advertising

  2. Phil Townsend

    spidur1 Guest

    Actually the item command is for an item in a template column. If you
    added a delete button it would that datagrid.deletecommand. An edit
    button would be the datagrid.edit command.

    What I usually do is add a button in a template column and set the
    property of the command name to "MyCommand" then add the following to
    your code behind page

    Private Sub MyCommandClick(ByVal source As Object, ByVal e As
    System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
    dgRenew.ItemCommand
    If e.CommandName = "MyCommmand" Then
    'PUT CODE HERE
    End If
    End Sub
     
    spidur1, Dec 30, 2004
    #2
    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. Northern
    Replies:
    0
    Views:
    407
    Northern
    Jul 22, 2003
  2. CGuy
    Replies:
    2
    Views:
    2,024
  3. John
    Replies:
    3
    Views:
    3,251
    Giorgio Parmeggiani
    Nov 3, 2003
  4. RSB
    Replies:
    6
    Views:
    7,699
    Karim
    May 19, 2004
  5. z. f.
    Replies:
    4
    Views:
    1,359
    z. f.
    Jun 23, 2004
Loading...

Share This Page