Events

C

Charles A. Lackman

Hello,

I have a UserControl that I am added to a page. In the User Control I
created a Public Event:

Public Event DoDelete (ByVal TheIndex as integer)

In a button click of the control I raise the Event:

RaiseEvent DoDelete(txtIndex.text)

I am having a difficult time getting the event to function inside the aspx
page the control is in. Here is how I am trying to accomplish this:

Dim MyControl as UserControl
MyControl = LoadControl("OrderControl.ascx")
Addhandler MyControl.DoDelete, AddressOf MyDelete

When the event in the control fires it does not go to MyDelete in the Aspx
page.

Any Suggestions will be greatly appreciated.

Thanks,
Chuck
 
L

Lucas Tam

Dim MyControl as UserControl
MyControl = LoadControl("OrderControl.ascx")
Addhandler MyControl.DoDelete, AddressOf MyDelete

When the event in the control fires it does not go to MyDelete in the
Aspx page.

Make sure your control has an unique ID for the name.
 
C

Charles A. Lackman

Hello,

I do have a Unique ID Name for the control, I just didn't add that in my
code example. IE:

lblCount += 1
MyChildControl = LoadControl("OrderChildControl.ascx")
DCP.Controls.Add(MyChildControl)
MyChildControl.ID = "Cont" & lblCount.ToString
AddHandler MyChildControl.DoDelete, AddressOf MyDelete

The control are added to the page in a button click and not in the page load
event, could this be adding to the problem?

Thanks,

Chuck

----- Original Message -----
From: "Lucas Tam" <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Sent: Tuesday, August 16, 2005 11:42 AM
Subject: Re: Events


Dim MyControl as UserControl
MyControl = LoadControl("OrderControl.ascx")
Addhandler MyControl.DoDelete, AddressOf MyDelete

When the event in the control fires it does not go to MyDelete in the
Aspx page.

Make sure your control has an unique ID for the name.

Hello,

I have a UserControl that I am added to a page. In the User Control I
created a Public Event:

Public Event DoDelete (ByVal TheIndex as integer)

In a button click of the control I raise the Event:

RaiseEvent DoDelete(txtIndex.text)

I am having a difficult time getting the event to function inside the aspx
page the control is in. Here is how I am trying to accomplish this:

Dim MyControl as UserControl
MyControl = LoadControl("OrderControl.ascx")
Addhandler MyControl.DoDelete, AddressOf MyDelete

When the event in the control fires it does not go to MyDelete in the Aspx
page.

Any Suggestions will be greatly appreciated.

Thanks,
Chuck
 

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,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top