javascript call

  • Thread starter Thread starter abcd
  • Start date Start date
A

abcd

I am novice asp.net programmer.

I have xyz.js file which has resuable functions. I have asp.net form
abcd.aspx and the code behind file abcd.aspx.cs, I want to put a 'Help'
button when clicked it will open a window and open the required file for
me.

I am have issues

1.I tried calling my xyz.js function i.e. ShowHelp in the call like in my
aspx page

<input type="button" OnClick="ShowHelp('/help/help.htm');" value="Help"
name="Help">

When I do this it does not open help.htm, I guess it needs full url path. I
have full url as a server side ViewState variable, how can I put that in the
above syntax so that the url will be complete

2. If I want to use asp server side control then how can I call ShowHelp
from server side call...

thanks
 
1. Did you include the JS file in the .aspx file? Here is how you do it:
<script language="javascript" src="xyz.js"></script>

If you want to specify the path from the server side variable, this is one
way:
<input type=button onclick="showhelp('<%= ViewStateVar %>');" value="Help">

2. You cannot call client-side JS functions from server-side.

I am novice asp.net programmer.

I have xyz.js file which has resuable functions. I have asp.net form
abcd.aspx and the code behind file abcd.aspx.cs, I want to put a 'Help'
button when clicked it will open a window and open the required file for
me.

I am have issues

1.I tried calling my xyz.js function i.e. ShowHelp in the call like in my
aspx page

<input type="button" OnClick="ShowHelp('/help/help.htm');" value="Help"
name="Help">

When I do this it does not open help.htm, I guess it needs full url path. I
have full url as a server side ViewState variable, how can I put that in the
above syntax so that the url will be complete

2. If I want to use asp server side control then how can I call ShowHelp
from server side call...

thanks
 
Thanks Siva

I am an old ASP programmer, I thought that I can not use <%=variable %> in
asp.net aspx page. but it worked as per u said....thanks in advance...

everything works great !

cheers !
 
abcd, glad to know it worked.

Thanks Siva

I am an old ASP programmer, I thought that I can not use <%=variable %> in
asp.net aspx page. but it worked as per u said....thanks in advance...

everything works great !

cheers !
 
1. In this case onclick event calls client-side javascript code. ShowHelp
should be a javascript function that will use one of a variety of ways to
open a page on client side.

2. You will still need to emit a javascript code that will call the
client-side javascript function ShowHelp.

Eliyahu
 

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

Back
Top