button OnClick override ignored but only under certain conditions?

  • Thread starter Thread starter PJ6
  • Start date Start date
P

PJ6

I'm having a problem I can't reproduce in a simple example. If I create a
class that inherits button and click on it in a web page, if I override the
OnClick method, on clicking, any code is executed, and any breakpoints
within it are hit. This exepcted behavior works in simple test projects
under a lot of different conditions.

OK so I put the exact same button inheritor in the live project that I'm
working on, and... the overriden OnClick method is *not* hit. No code
executes, no breakpoints are hit within it, and I have no idea why. Since I
cannot simply reproduce the problem (and therefore have no code I can
reasonably post) I was hoping someone might, off the top of their head, give
me a few guesses as to why this is happening, or offer a suggestion for
diagnosing the problem.

TIA,
Paul
 
I assume you mean OnClick on the Server?
Does the page even reload? Is Page_Load being called?
Is the submit on the client executed?

No validators in the way?
 
Server OnClick.

The page reloads, which I verified with a breakpoint.

I'm not emitting or concerned with any clientside code for this particular
problem.

No validators.

Paul
 
Check the "__EVENTTARGET" property in the Page_Load method.

string target = Request["__EVENTTARGET"];

This should contain the name of your button.

Remy Blaettler
www.collaboral.com
 
Target shows as nothing... but I get nothing for when it works, too.

Paul
 
If I dynamically add a button - not OnLoad, but from the click event of
another button, that button's click event is completely ignored server-side.
Is this a bug? Is there a way to get it to work?

Paul

PJ6 said:
Target shows as nothing... but I get nothing for when it works, too.

Paul

Remy said:
Check the "__EVENTTARGET" property in the Page_Load method.

string target = Request["__EVENTTARGET"];

This should contain the name of your button.

Remy Blaettler
www.collaboral.com
 
Oh, man. I see why now. Boy do I hate web development.

Paul

PJ6 said:
If I dynamically add a button - not OnLoad, but from the click event of
another button, that button's click event is completely ignored
server-side. Is this a bug? Is there a way to get it to work?

Paul

PJ6 said:
Target shows as nothing... but I get nothing for when it works, too.

Paul

Remy said:
Check the "__EVENTTARGET" property in the Page_Load method.

string target = Request["__EVENTTARGET"];

This should contain the name of your button.

Remy Blaettler
www.collaboral.com
 
and, what was the issue?

--
Remy Blaettler
Helping you collaborate better!
www.collaboral.com


PJ6 said:
Oh, man. I see why now. Boy do I hate web development.

Paul

PJ6 said:
If I dynamically add a button - not OnLoad, but from the click event of
another button, that button's click event is completely ignored
server-side. Is this a bug? Is there a way to get it to work?

Paul

PJ6 said:
Target shows as nothing... but I get nothing for when it works, too.

Paul

Check the "__EVENTTARGET" property in the Page_Load method.

string target = Request["__EVENTTARGET"];

This should contain the name of your button.

Remy Blaettler
www.collaboral.com
 
See my later post "on method for handling dynamic control events", which
should read "one method for handling dynamic control events". I thought my
solution was cool enough to share, though I'm sure someone's thought of it
before.

Paul

Remy Blaettler said:
and, what was the issue?

--
Remy Blaettler
Helping you collaborate better!
www.collaboral.com


PJ6 said:
Oh, man. I see why now. Boy do I hate web development.

Paul

PJ6 said:
If I dynamically add a button - not OnLoad, but from the click event of
another button, that button's click event is completely ignored
server-side. Is this a bug? Is there a way to get it to work?

Paul

Target shows as nothing... but I get nothing for when it works, too.

Paul

Check the "__EVENTTARGET" property in the Page_Load method.

string target = Request["__EVENTTARGET"];

This should contain the name of your button.

Remy Blaettler
www.collaboral.com
 

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

Back
Top