473,671 Members | 2,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET 2.0 Raising a custom event from a usercontrol to parent page: How?

Hi all, I have a user control which I want to raise a custom event from so
the parent page can reload a datagrid with some new information.

In the 1.1 framework days I would have just done something like the
following in my user control:

public delegate void _departmentClic k (object sender, int e);
public event _departmentClic k DepartmentClick ;

And then called the DepartmentClick event when I wanted to inform the parent
page.

Then in the parent page I would have explicitly created the usercontrol and
created an event handler for the DepartmentClick event. No worries...

How the hang do I do the same thing in ASP.NET 2.0?

I can create the delegate etc no problem in the UserControl but in the
parent page, how / where do I create the event handler???

TIA
Mark

Mar 25 '06 #1
1 1924
Hi all, I fixed my own problem, it is pretty much the same as 1.1. I just
did not have to declare an instance of the user controls as asp.net 2.0
automatically picked up that there was an instance of the user control on
the page.

Cheers
Mark
"Jimi" <ji**@hered.com > wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Hi all, I have a user control which I want to raise a custom event from so
the parent page can reload a datagrid with some new information.

In the 1.1 framework days I would have just done something like the
following in my user control:

public delegate void _departmentClic k (object sender, int e);
public event _departmentClic k DepartmentClick ;

And then called the DepartmentClick event when I wanted to inform the
parent page.

Then in the parent page I would have explicitly created the usercontrol
and created an event handler for the DepartmentClick event. No worries...

How the hang do I do the same thing in ASP.NET 2.0?

I can create the delegate etc no problem in the UserControl but in the
parent page, how / where do I create the event handler???

TIA
Mark

Mar 26 '06 #2

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

Similar topics

7
2681
by: Colin Young | last post by:
I have a UserControl that contains a calendar control. The calendar is not raising events (month navigation, date selections, etc.). I've checked that the OnSelectionChanged event has a handler being registered. Is there anything else obvious or otherwise that I've missed? Is there a problem using it in a UserControl? Thanks Colin
1
11569
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
0
2432
by: Gary Shell | last post by:
I am experiencing some strange behavior between a UserControl's validating event and a treeview control. Initially, I thought it was related to an issue in the Knowledgebase article 810852 (http://support.microsoft.com/kb/810852), but then I realized that the hotfix mentioned was in .Net v1.1, which I am using. I took the sample from that article and recreated the situation I see in my application. (Code included below.) If you run the...
5
1729
by: snesbit | last post by:
If a screen is made up of several user controls and those user controls contain various packaged or standard controls such as a grid, how do you raise both standard and custom events from the user control so the form containing the user control can see the events you want them to see. Help Please....
2
2167
by: Tina | last post by:
(my last post was incomplete so this issue is being reposted) I have an ASP.Net C# app with a Default.aspx page with an ascx user control on the page named EditGrid.ascx given the ID myEG on the page. I am trying to raise a custom event in this user control passing custom data arguments. I have done this many times in VB but this is my first time in C#.
2
1820
by: RSH | last post by:
Hi, I have been trying to follow a tutorial on raising an event from a user control and then handling it in the parent page. The article is a little vague so I believe I have the code in place, but I cant seem to get it to work. Here is what I have:
0
2937
by: CMELLO | last post by:
I have am dynamically loading a web user control based on the click of a tab strip I load the default control for the first tab in the page load event after checking page is not postback. After that the controls are loaded/unloaded based on the SelectionChanged event for the tab strip and again in Page load because with a dynamic load viewstate has to be reloaded. I have a datalist in the user control and I am trying to create the...
0
1911
by: =?Utf-8?B?Y2luZHk=?= | last post by:
I have am dynamically loading a web user control based on the click of a tab strip I load the default control for the first tab in the page load event after checking page is not postback. After that the controls are loaded/unloaded based on the SelectionChanged event for the tab strip and again in Page load because with a dynamic load viewstate has to be reloaded. I have a datalist in the user control and I am trying to create the...
4
2479
by: =?Utf-8?B?UmljaEI=?= | last post by:
I am trying to create a project using the ASP.NET AJAX accordion control. I would like to dynamically add panes to the control with a form template added when the pane is added. I have tried unsuccessfully in creating the whole pane as a user control and have succeeded in adding the pane and then dynamically adding the content which is a user control to the pane, dynamically within the page. However I would like to have a single pane...
0
8483
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8402
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8605
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5703
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4416
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.