Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Grid Control ItemData event not firing

Reply
Thread Tools

Grid Control ItemData event not firing

 
 
HandA
Guest
Posts: n/a
 
      05-12-2004
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



 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      05-12-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>
>
>


 
Reply With Quote
 
 
 
 
HandA
Guest
Posts: n/a
 
      05-12-2004
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]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >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
> >
> >
> >

>



 
Reply With Quote
 
SStory
Guest
Posts: n/a
 
      05-13-2004
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]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >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
> >
> >
> >

>



 
Reply With Quote
 
SStory
Guest
Posts: n/a
 
      05-13-2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > >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
> > >
> > >
> > >

> >

>
>



 
Reply With Quote
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      05-13-2004
Thanks for reporting back!

"SStory" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SORTING AND ITEMDATA BOUND PROPERTY OF DATAGRID IN ASP.NET =?Utf-8?B?SGlyYWs=?= ASP .Net 0 05-29-2006 05:17 AM
firing SelectedIndexChanged event in custom grid inherited control johnny ASP .Net Web Controls 0 07-20-2004 10:06 AM
ListBox and ItemData Michael Debus ASP .Net Web Controls 2 04-12-2004 05:05 PM
ItemData -- Combo and List Box Phiil MCAD 1 11-18-2003 05:26 PM
ItemData -- Combo and List Box Luis Garza MCAD 0 11-18-2003 05:14 PM



Advertisments