Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trigger JavaScript with ASP.NET "OnClick" 1

Status
Not open for further replies.

Isadore

Technical User
Feb 3, 2002
2,167
US
I know how to create an event handler in a textbox, triggering a JavaScript event, e.g.,

txtmytextbox.attributes.add("OnChange", "myfucntion(this);")

How do I trigger a JavaScript event with an ASP.NET button without creating an HTML button? I would like to fire the OnClick event of the ASP.NET button and at the same time trigger the call for the execution of a JavaScript function.

Any ideas?
 
D'Arcy: yes, I hear ya. 2 clicks is what I experienced. I think for the time being the best thing to do is go ahead and take advantage of the summary dialog that is part of dot net validation family. Javascript is especially powerful, and I can't see a data web page with it, but double clicks, this and that, doesn't appeal to me.

One more question D. Do you know the command to re-maximize the window on a Response.redirect? In this example I am calling up a "Password" dialog, so want it small, and then once through that, I want to return to the normal size web page. My experience last night was that the next page retained the memory of the small size. So sort of "close" this window and redirect to a normal size window.

Thanks for your time, it is much appreciated.
 
I *think* that you can only handle the size of a window through client script, which would mean that you're password window would have to close itself, and on its page_unload event call the window.open() javascript function, where you can actually specify the parameters of the new window being open. What you might want to consider is a different way to do the username password screen though

i.e. does it *have* to be smaller? We have a login screen for our member portal, but its just a page with the textboxes in the middle, and that way you never have to worry bout programatically changing the browser size.

hth

D
 
Izy did you get that variable to change? The code that I wrote did need to be in the page_load event to work with a single click.

What happens to say that the 'word' variable needs to change? Can you set something on that even? That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Zarc: Yes, the code worked fine. Everything is working fine. D'Arcy, you may be right. Just keep it a regular page, and you don't have to go through all this trouble. My impression was that a "pop-up" looks a little classier, but its a matter of opinion -- however, it takes extra code, etc... and so you are probably correct here. I think I'll just sharpen up the page I have and temporarily drop this notion of a pop-up log in page.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top