473,786 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event object is null when event is fired. WebUserControl ASP.NET/AJAX

I have a WebUserControl with a custom event, when this event is fired,
the delegate or event object is throwing a null reference exception.
The odd part of this is, it used to work flawlessly, now it never
works. I'm not sure what change affected the event while my coworker
and I were working on this control.

Here's the event code in the control from which the event is spawned:
<code>
public Guid DbReferenceID {
get {
if (ViewState["contactID"] != null) {
return (Guid)ViewState["contactID"];
} else {
return new Guid();
}
}
set {
ViewState.Add(" contactID", value);
SetID(value);
}
}

public delegate void DoctorAction(Gu id doctorID, DoctorActions
action);
public event DoctorAction OnDoctorAction;
public enum DoctorActions {
Add,
Edit,
Delete,
Select
}

protected void Doctor_Click(ob ject sender, CommandEventArg s e) {
// This if statement is only for testing. Currently, OnDoctorAction is
always null
if(OnDoctorActi on == null) {
System.Windows. Forms.MessageBo x.Show("Nobody is listening to
this event!");
}else {
OnDoctorAction( DbReferenceID, DoctorActions.A dd);
}
}
</code>

This is the code that responds to the action in the control's parent
control:
<code>
protected void Page_Load(objec t sender, EventArgs e) {
DoctorSearchUse rDoctor.OnDocto rAction += new
User_Controls_D octorSearchCard .DoctorAction(D octorSearchUser Doctor_OnDoctor Action);
}

void DoctorSearchUse rDoctor_OnDocto rAction(Guid doctorID,
User_Controls_D octorContactPop Up.DoctorAction s action) {
// Event never gets this far.
AIMDoctorsTable Adapters.Doctor sTableAdapter drTableAdapter = new
AIMDoctorsTable Adapters.Doctor sTableAdapter() ;
switch (action) {
case (User_Controls_ DoctorContactPo pUp.DoctorActio ns.Add):
drTableAdapter. SetUserID(UserI D, doctorID);
SetDoctor();
break;
}
}
</code>

We've been trying to find a solution to this problem for two days now,
but we are stumped. Any ideas? If anymore information is needed, of
course, let me know and I'll do my best to supply it.

Aug 28 '07 #1
0 1444

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

Similar topics

2
1589
by: Thomas | last post by:
Hi there I build a class "ButtonClass" with two private Buttons, "OK" And "Cancel". Now, I would like to use this class in a Windowsform for example three times. ButtonClass c1 = new ButtonClass(); ButtonClass c2 = new ButtonClass(); ButtonClass c3 = new ButtonClass();
7
13356
by: sanjana | last post by:
hi i wanna detect if a anything is connected to the usb port I am using system.management class for tht purpose this is my code class usbdetect { public static void Main() {
1
11585
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. ...
4
3992
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques was endeavoring to create a custom user control to make things a bit simpler, but she noticed that her Page_Load eventhandler was firing twice. So after long hours of research and experimentation, I stumbled upon, imho, is quite the discovery. ...
0
1306
by: Ben S | last post by:
vs2005, .net fw 2.0 the questions is, how can I cause the label to change in my client page triggered by an event raised from the user control which is on my master page. I have a master page (M) which contain a user control (U). My client page (C) has a sub that needs to run if U raise an event. The examlpe has been simplified to just button clicks and update label with
1
5364
by: Jeremy Martin | last post by:
Hi, I am currently learning c# so be gentle :) I am converting a Delphi.NET website to c# website and I am confused as to how events are handled. 2 Situations. 1. A component on a webusercontrol fires a postback event. On postback
21
29821
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays prodcut anme have used ajax to avoid refreshing of page this works fine 2.now i have created one row with checkbox|select box|text|text|text|text| where in the select box values are fetched from table here also i have used ajax for getting the m_name...
5
4302
by: Klaudiusz Bryja | last post by:
Hi, This is for NetCF 2.0. I need to create event handling code which using reflection. I have some parameters in XML which describe how event should be handled. I have code to create delegate: public class DelegateEx {
1
108777
Frinavale
by: Frinavale | last post by:
Introduction I've seen many questions asked about how to disable the browser's back button and in the past I've replied with "it's simply not possible". It's not a good idea to disable the back button anyways, if the user ventures away from your page then they wouldn't have this button at their disposal. The main reason people ask how to control or disable the back button is because they have a need to control sensitive (and/or) dynamic web...
0
10360
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10163
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
10108
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
9960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5397
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
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.