Event not firing

T

tshad

How do I get this event to fire without a code behind page. I want to have
this in one ASP.NET page (I know it may be cleaner with a codebehind).

I first tried this:

Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)

and nothing happened. I then tried to had the "Handles" clause:

Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound

and got an error:

Compiler Error Message: BC30506: Handles clause requires a WithEvents
variable.

How can I make this event fire in the same page?

Thanks,

Tom.
 
V

vMike

tshad said:
How do I get this event to fire without a code behind page. I want to have
this in one ASP.NET page (I know it may be cleaner with a codebehind).

I first tried this:

Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)

and nothing happened. I then tried to had the "Handles" clause:

Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound

and got an error:

Compiler Error Message: BC30506: Handles clause requires a WithEvents
variable.

How can I make this event fire in the same page?

Thanks,

Tom.
You should make sure you have AutoEventWireup="True" in your Page directive
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top