How to call javascript function from code behind

V

verci

Hi guys,
I'm running asp.net 2.0.

Does anyone know how to fire or call a javascript function from inside my
(VB.aspx) code without assigning it to a control attribute?

thank you
 
B

Ben Rush

When you say "call javascript function" you mean actually executing it like
any normal .Net method from the server, but within the browser? *that*
cannot be done because there is no direct link between the client and the
server once the page has been handed to the browser.

If you mean something else, please fill me in becuase I'm confused.
 
V

verci

OK, let me try to explain.

I've an external js file called functions.js, inside this file there's a
function jumpto() that takes a string parameter:
jumpto('MainPage/salaries.html')

which I call from my aspx page like this:

<a href="javascript:jumpto('MainPage/salaries.html')">Salary</a>

Now what I'm tryin to acheive is to passed the name of the html file via
querystring from page1 to page2.aspx like this:

Page1:

<a href="/comunidad/Articles.aspx?webPage=salaries">Totals</a>

Page 2:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Dim mypage As String = ""

mypage = Request.QueryString("webPage") & ".html"

Page.ClientScript.RegisterStartupScript("script", "jumpto('MainPage/" +
mypage + "')", True)

End Sub



So far I'm stuck, any help would be very appreciated.

Best regards
 
V

verci

I've just go it working!!! about five minutes ago

Thank you so much anyway for your help :)
 

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,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top