Controls dissapear when javascript function is called

LiLo

Freshman
Joined
Mar 10, 2006
Messages
33
Hi, :)

Why does the asp.net controls dissapear when javascript method is called?

Using Visual Studio 2005, I created an asp.net webpage where I placed button controls and a radio button list on the webpage. I have also added a javascript file to the asp.net project.

The javascript file is called Frames.js. It is responsible for displaying an IFrame. The javascript method inside Frames.js is called showIFrame().

Under the page_Load(...) method, I called the javascript function using:

Page.RegisterClientScriptBlock("MyScript", "<script language=javascript src='Frames.js'>")

Button1.Attributes.Add("onclick", "showIFrame()")

When I ran the web application, the javascript method did not seem to run and the buttons and radio button list controls did not appear. When I removed the Page.RegisterClientScriptBlock method, the controls could appear.

So, what is wrong with the RegisterClientScriptBlock method? It seems to be the correct method to use when calling a javascript method.
 
Page.RegisterClientScriptBlock("MyScript", "<script language=javascript src='Frames.js'>")


</script>
end the script tag
 
Back
Top