Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 9th, 2006, 07:30 AM
Authorized User
 
Join Date: Sep 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default UsingJavaScript ReturnValue

Hi Friends ,

        I want to use return value from javascript in my .aspx
page. How do i call it and use the return value from javascript to
codebehind page.

    here is an example wt i want to do?

    this is my javascript function

    function test()
      {
        return val
      }
    And I want to use value returned in the val variable to my codebehind page.

       Please guide me.

Thanks in Advance.

 
Old November 9th, 2006, 07:41 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi

Its a bit odd to call a Javascript, return a value and assign it to a server side variable. What I would suggest is that you assign the value to a hidden control via your javascript function, and then fetch the value of that hidden in your server side code.

Else I suggest that you try some different approach towards your coding method (unless and until it is tooooo difficult).

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old November 10th, 2006, 05:46 AM
Skb Skb is offline
Authorized User
 
Join Date: Oct 2006
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

u can assign the value to server side control in Javascript itself...

 
Old November 10th, 2006, 05:49 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yup

You can, by simply using

document.getElementById("controlname").value = "Some Value";

But remember only the value of hidden is maintained during postbacks if you want to store something.

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing RETURNVALUE from SP using FormView mtschindler ASP.NET 2.0 Basics 1 April 15th, 2008 04:40 AM
'event.returnValue=false' equivalent for Firefox nitinp ASP.NET 2.0 Basics 0 February 5th, 2007 11:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.