Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...