473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Events

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
Nov 19 '05 #1
2 1442
"Charles A. Lackman" <Ch*****@CreateItSoftware.net> wrote in
news:uy**************@tk2msftngp13.phx.gbl:
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.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
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" <RE********@rogers.com>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Sent: Tuesday, August 16, 2005 11:42 AM
Subject: Re: Events
"Charles A. Lackman" <Ch*****@CreateItSoftware.net> wrote in
news:uy**************@tk2msftngp13.phx.gbl:
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.

"Charles A. Lackman" <Ch*****@CreateItSoftware.net> wrote in message
news:uy**************@tk2msftngp13.phx.gbl...
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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sasha | last post by:
Hi everyone, Here is my problem: I have the following classes: - DataNode - this class is designed to hold some data and will be contained in a tree like data structure DataTree. When...
6
by: Saso Zagoranski | last post by:
Hi! How can I unregister all the events registered to a control? I have seen a piece of code in another thread, which gets all the registered handlers for a specific event. Let's say I have a...
14
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using...
2
by: Bob Rundle | last post by:
I have the following code, which appears to be working. However it doesn't look right. The part I am wondering about is the logic in DisconnectEvents(). This logic creates a new delegate and...
4
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on...
11
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
30
by: Burkhard | last post by:
Hi, I am new to C# (with long year experience in C++) and I am a bit confused by the language construct of events. What is it I can do with events that I cannot do with delegates? At the moment...
5
by: Richard Maher | last post by:
Hi, Here I mean "User" in the Programmer or Javascript sense. I merely wish to programmatically trigger an Event. It would be absolutely fantastic if there was a (Form level?) ONUSEREVENT() and...
14
by: xoozlez | last post by:
Hi there, I have a registration form where I like to filter out the past events of 2007. This is the code I am using : strSQL = "SELECT EventID, EventName, EventDateBegin, EventDateEnd,...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.