Page button throws exception even when handler is empty

  • Thread starter ~~~ .NET Ed ~~~
  • Start date
N

~~~ .NET Ed ~~~

I have a web form that displays some information and then at the bottom it
has a Button control. This control has both a Click and Command event
handlers.

I was getting the following exception when the button was pressed:


[NullReferenceException: Object reference not set to an instance of an
object.]
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +28
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292At that time only the Click
handler had something and it was very simple: if
(this.ButtonContinue.CommandName != null) { ... }I eliminated all the code
from both the Click and Command event handlers,
 
N

~~~ .NET Ed ~~~

The message went out prematurely (again, thx to Outlook Express's express
intentions)...

I was saying, the code in the event handlers was very simple, the only thing
that could go wrong there is
if the ButtonContinue control was not initialized which shouldn't happen
anyway.

Then I removed ALL the code from both event handlers, the only thing
remaining is the event handler
methods and their respective association to the ButtonContinue control in
the InitializeComponent(). Well
even in this minimal form, the same exception is thrown when the button is
pressed.

Any idea what is going wrong there? it really doesn't provide more
information.

Thx,
Emil
 

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

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top