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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call JavaScript Function From Page Event

Status
Not open for further replies.

BDRichardson

Programmer
Jul 23, 2003
46
0
0
GB
Hi,

This problem has been baffling me for some time now.

I wish to determine the client area of a webform using JavaScript, so that I can then re-size controls appropriately within the form.

I believe that I may be able to accomplish this by somehow calling a JavaScript function from within a Page event handler. For example, when the form loads, or is resized, I could call the JavaScript function(s) and store the returned values in local C# class fields.

I also wish to store the JavaScript in an external file, and register it, probably using the 'RegisterClientScriptInclude' method.

Please can anyone clarify whether this is both feasible, and sensible solution to the problem. If so, how can I call the function from within a Page event?

I am aware that you can call JavaScript functions from within Markup code, but I believe I need to do it from within C#, because I need to use the values returned from the function to set WebForm Control properties.

Any assistance would be greatly appreciated.
 
I think you should make this post on the ASP.NET forum instead : forum855

[wink]
 
Fair point. I admit that I was little unsure of exactly which forum I should have posted it.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top