Re: calling javascript function at runtime in asp.net

A

Anatoly

Call RegisterStartupScript sub instead of Response.Write


nileshw said:
Hi,

The requirement is like I want to call one javascript function in onload
event of body tag at run time in code behind of asp.net page. I dont want
to hard code this function in onload event becuase this javascript function
accepts some parameters and the value for this parameter come from database.
for example

'code in page1.aspx

<HTML><HEAD><title>WebForm6</title><script language="javascript">
function try1(strMsg)
{
alert(strMsg);
}
</script></HEAD><body id="b1"><form id="Form1" method="post"
runat="server"><asp:textbox id="TextBox1" style="Z-INDEX: 101; LEFT: 184px;
POSITION: absolute; TOP: 80px"
runat="server"> said:
'code in page1.aspx is end here

'code in page1.aspx.vb

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
 
G

Guest

Hi Anatoly
Thanks for your prompt reply
I used RegisterStartupScript sub instead of Response.Write in my code.It display the alert message. But after displaying message it throws javascript error as follows
HTMLFile : not implemente

I am using IE 6. I have not checked my code in netscape

How to solve this problem

Thanks and regard
Nilesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top