Grid Control ItemData event not firing

Discussion in 'ASP .Net Datagrid Control' started by HandA, May 12, 2004.

  1. HandA

    HandA Guest

    I have a grid control on a page that I copied from another page and
    modified.
    For some reason it seem my ItemData event never fires.

    I even put a break point in it and it doesn't get there.
    I tried response.write and response.end in that event and it doesn't output
    anything.

    Any ideas?

    Thanks
     
    HandA, May 12, 2004
    #1
    1. Advertising

  2. Could you post the code that isn't working? The event handler should look
    like this:

    Private Sub DataGrid1_ItemDataBound _
    (ByVal sender As Object, _
    ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
    Handles DataGrid1.ItemDataBound
    ' Your code goes here
    End Sub

    VS.NET used to play tricks by removing the Handles clause.


    "HandA" <> wrote in message
    news:...
    >I have a grid control on a page that I copied from another page and
    > modified.
    > For some reason it seem my ItemData event never fires.
    >
    > I even put a break point in it and it doesn't get there.
    > I tried response.write and response.end in that event and it doesn't
    > output
    > anything.
    >
    > Any ideas?
    >
    > Thanks
    >
    >
    >
     
    Ken Cox [Microsoft MVP], May 12, 2004
    #2
    1. Advertising

  3. HandA

    HandA Guest

    Well, I checked for that and it seemed to be right.
    I am not at the computer that has the code on it at present. I will respond
    as soon as I back at that location with the code.

    It did have a handles event that appeared right at first glance.

    Will get back to you.

    Thanks

    Shane
    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:...
    > Could you post the code that isn't working? The event handler should look
    > like this:
    >
    > Private Sub DataGrid1_ItemDataBound _
    > (ByVal sender As Object, _
    > ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
    > Handles DataGrid1.ItemDataBound
    > ' Your code goes here
    > End Sub
    >
    > VS.NET used to play tricks by removing the Handles clause.
    >
    >
    > "HandA" <> wrote in message
    > news:...
    > >I have a grid control on a page that I copied from another page and
    > > modified.
    > > For some reason it seem my ItemData event never fires.
    > >
    > > I even put a break point in it and it doesn't get there.
    > > I tried response.write and response.end in that event and it doesn't
    > > output
    > > anything.
    > >
    > > Any ideas?
    > >
    > > Thanks
    > >
    > >
    > >

    >
     
    HandA, May 12, 2004
    #3
  4. HandA

    SStory Guest

    Hi Ken,

    I wrote you before from a different machine, thus the HandA

    Anyhow,

    Here is the code..

    'at the top
    Protected WithEvents grdRepInvoices As System.Web.UI.WebControls.DataGrid

    'then the event code
    Private Sub grdRepInvoices_ItemCommand(ByVal source As Object, ByVal e As
    system.Web.UI.WebControls.DataGridCommandEventArgs) Handles
    grdRepInvoices.ItemCommand
    Response.Write("got here")
    Response.End()
    end sub

    Like I said, I use the same code in several pages but for some reason this
    appears to never fire.
    I am dumbfounded and looking for some obvious dumb mistake but can't see it
    yet.

    Thanks,

    Shane

    "Ken Cox [Microsoft MVP]" <> wrote in message
    news:...
    > Could you post the code that isn't working? The event handler should look
    > like this:
    >
    > Private Sub DataGrid1_ItemDataBound _
    > (ByVal sender As Object, _
    > ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
    > Handles DataGrid1.ItemDataBound
    > ' Your code goes here
    > End Sub
    >
    > VS.NET used to play tricks by removing the Handles clause.
    >
    >
    > "HandA" <> wrote in message
    > news:...
    > >I have a grid control on a page that I copied from another page and
    > > modified.
    > > For some reason it seem my ItemData event never fires.
    > >
    > > I even put a break point in it and it doesn't get there.
    > > I tried response.write and response.end in that event and it doesn't
    > > output
    > > anything.
    > >
    > > Any ideas?
    > >
    > > Thanks
    > >
    > >
    > >

    >
     
    SStory, May 13, 2004
    #4
  5. HandA

    SStory Guest

    Ken, the issue was on binding
    I was binding if not ispostback but not if it is postback
    since grid uses paging and doesn't enable viewstate this was the problem it
    seems.

    Thanks,
    Shane

    ps. Found interesting info on this at.
    http://west-wind.com/weblog/posts/211.aspx

    "SStory" <> wrote in message
    news:%...
    > Hi Ken,
    >
    > I wrote you before from a different machine, thus the HandA
    >
    > Anyhow,
    >
    > Here is the code..
    >
    > 'at the top
    > Protected WithEvents grdRepInvoices As System.Web.UI.WebControls.DataGrid
    >
    > 'then the event code
    > Private Sub grdRepInvoices_ItemCommand(ByVal source As Object, ByVal e As
    > system.Web.UI.WebControls.DataGridCommandEventArgs) Handles
    > grdRepInvoices.ItemCommand
    > Response.Write("got here")
    > Response.End()
    > end sub
    >
    > Like I said, I use the same code in several pages but for some reason this
    > appears to never fire.
    > I am dumbfounded and looking for some obvious dumb mistake but can't see

    it
    > yet.
    >
    > Thanks,
    >
    > Shane
    >
    > "Ken Cox [Microsoft MVP]" <> wrote in message
    > news:...
    > > Could you post the code that isn't working? The event handler should

    look
    > > like this:
    > >
    > > Private Sub DataGrid1_ItemDataBound _
    > > (ByVal sender As Object, _
    > > ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) _
    > > Handles DataGrid1.ItemDataBound
    > > ' Your code goes here
    > > End Sub
    > >
    > > VS.NET used to play tricks by removing the Handles clause.
    > >
    > >
    > > "HandA" <> wrote in message
    > > news:...
    > > >I have a grid control on a page that I copied from another page and
    > > > modified.
    > > > For some reason it seem my ItemData event never fires.
    > > >
    > > > I even put a break point in it and it doesn't get there.
    > > > I tried response.write and response.end in that event and it doesn't
    > > > output
    > > > anything.
    > > >
    > > > Any ideas?
    > > >
    > > > Thanks
    > > >
    > > >
    > > >

    > >

    >
    >
     
    SStory, May 13, 2004
    #5
  6. Thanks for reporting back!

    "SStory" <> wrote in message
    news:...
    > Ken, the issue was on binding
    > I was binding if not ispostback but not if it is postback
    > since grid uses paging and doesn't enable viewstate this was the problem
    > it
    > seems.
    >
    > Thanks,
    > Shane
    >
    > ps. Found interesting info on this at.
    > http://west-wind.com/weblog/posts/211.aspx
     
    Ken Cox [Microsoft MVP], May 13, 2004
    #6
    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. vatech1993
    Replies:
    4
    Views:
    5,692
    =?Utf-8?B?U8Opcmdpbw==?=
    Dec 11, 2004
  2. =?Utf-8?B?SGlyYWs=?=
    Replies:
    0
    Views:
    435
    =?Utf-8?B?SGlyYWs=?=
    May 29, 2006
  3. RickM
    Replies:
    1
    Views:
    475
    Peter Kellner
    Apr 10, 2006
  4. Michael Debus

    ListBox and ItemData

    Michael Debus, Apr 11, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    268
  5. johnny
    Replies:
    0
    Views:
    137
    johnny
    Jul 20, 2004
Loading...

Share This Page