Why CancelButton's OnClientClick cannot be set programmatically in a wizard?

  • Thread starter Thread starter Bogdan
  • Start date Start date
B

Bogdan

Hi,

I'm trying to programmatically assign a script to a CancelButton's
OnClientClick in a wizard step. I'm doing it in ActiveStepChanged event
handler. I'm also assigning scripts to finish and previous buttons in the
same handler without any problems (btw, the same script is assigned to
previous and cancel buttons). When I view source on the client side I can
see onclick set to my scripts for finish and previous buttons but the cancel
button has no onclick property at all.

Assigning a script to OnClientClick declaratively (i.e. through IDE) works
fine.

Has anyone run into this problem?
I'd appreciate _any_ suggestions.

Thanks,
Bogdan
 
I figured out what the problem was. I was setting onclick on a different
cancel button that I was supposed to. I was getting references to finish
and previous buttons by calling FindControl(id, Page.Controls). That worked
fine for previous and finish buttons because they had unique ids (i.e.
"FinishPreviousButton" and "FinishButton"). I then (few weeks later) tried
to use the same code to reference the cancel button. I forgot that the
cancel button on the finish page had the same id (i.e. "CancelButton") as on
the other page.

Bogdan
 
Back
Top