473,386 Members | 1,736 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,386 software developers and data experts.

button OnClick override ignored but only under certain conditions?

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
Nov 19 '05 #1
8 2226
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?
"PJ6" <no****@nowhere.net> wrote in message
news:Ob**************@TK2MSFTNGP14.phx.gbl...
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

Nov 19 '05 #2
PJ6
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

"Remy Blaettler" <rb********@hotmail.com> wrote in message
news:eg**************@TK2MSFTNGP09.phx.gbl...
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?
"PJ6" <no****@nowhere.net> wrote in message
news:Ob**************@TK2MSFTNGP14.phx.gbl...
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


Nov 19 '05 #3
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

Nov 19 '05 #4
PJ6
Target shows as nothing... but I get nothing for when it works, too.

Paul

"Remy" <rb********@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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

Nov 19 '05 #5
PJ6
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" <no****@nowhere.net> wrote in message
news:eI**************@TK2MSFTNGP15.phx.gbl...
Target shows as nothing... but I get nothing for when it works, too.

Paul

"Remy" <rb********@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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


Nov 19 '05 #6
PJ6
Oh, man. I see why now. Boy do I hate web development.

Paul

"PJ6" <no****@nowhere.net> wrote in message
news:Ow**************@TK2MSFTNGP12.phx.gbl...
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" <no****@nowhere.net> wrote in message
news:eI**************@TK2MSFTNGP15.phx.gbl...
Target shows as nothing... but I get nothing for when it works, too.

Paul

"Remy" <rb********@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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



Nov 19 '05 #7
and, what was the issue?

--
Remy Blaettler
Helping you collaborate better!
www.collaboral.com
"PJ6" <no****@nowhere.net> wrote in message
news:eI**************@TK2MSFTNGP12.phx.gbl...
Oh, man. I see why now. Boy do I hate web development.

Paul

"PJ6" <no****@nowhere.net> wrote in message
news:Ow**************@TK2MSFTNGP12.phx.gbl...
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" <no****@nowhere.net> wrote in message
news:eI**************@TK2MSFTNGP15.phx.gbl...
Target shows as nothing... but I get nothing for when it works, too.

Paul

"Remy" <rb********@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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



Nov 19 '05 #8
PJ6
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" <rb********@hotmail.com> wrote in message
news:u3**************@TK2MSFTNGP15.phx.gbl...
and, what was the issue?

--
Remy Blaettler
Helping you collaborate better!
www.collaboral.com
"PJ6" <no****@nowhere.net> wrote in message
news:eI**************@TK2MSFTNGP12.phx.gbl...
Oh, man. I see why now. Boy do I hate web development.

Paul

"PJ6" <no****@nowhere.net> wrote in message
news:Ow**************@TK2MSFTNGP12.phx.gbl...
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" <no****@nowhere.net> wrote in message
news:eI**************@TK2MSFTNGP15.phx.gbl...
Target shows as nothing... but I get nothing for when it works, too.

Paul

"Remy" <rb********@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
> 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
>



Nov 19 '05 #9

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

Similar topics

5
by: Vern | last post by:
I'd like the default text to show up in designer, and allow it to be changed to something else. I was able to change some of the other properties, but for some reason I'm having trouble with the...
3
by: IntraRELY | last post by:
I need to attach the following 2 little scripts to an ASP.NET Button. I am having an issue with running both of the Attributes.Add. I can only get on to work at once. I have also tried to put them...
4
by: Carlo Marchesoni | last post by:
I have a button that opens a new Window (some kind of search-window), which is fired using JavaScript (btnSearch.Attributes=".....";) Now I need to run some code behind code BEFORE this JavaScript...
2
by: Sedef | last post by:
Hi, i'm trying to create a custom Button user control which will be derived from System.Web.UI.WebControls.Button. the normal server side Button class creates some client side javascript code for...
3
by: hb | last post by:
Hi, I have a asp:button btnGo. When clicking this button, the code will parse a asp:table to find a specific ID under certain conditions. Once the ID is found, the code need to keep the current...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
4
by: Mick Doherty | last post by:
Steps to reproduce: Inherit from button. Add button to project's form. Run project. Make button Default. Press and Hold SpaceBar (so button is pressed) Move Mouse. Release SpaceBar.
3
by: libsfan01 | last post by:
Hi all is it possible to onclick of a button in one form submit that form and also submit another form on the same page, both with the same 'action' location? or is it only possible to send one...
0
by: Tom | last post by:
The included code block demonstrates programmatically clicking a non-derived ToolStripButton in the OnShown() method. When I derive a button from ToolStripButton and override the _private_...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...

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.