Sending values from server side to Client side javascript

Discussion in 'Javascript' started by Renuka, Nov 13, 2003.

  1. Renuka

    Renuka Guest

    Hello,

    Can someone help me with the following situation??

    I have a Hyperlink within a String like below:

    sSql = "SELECT DISTINCT " + "'Action' = '<center><a
    href='+char(34)+'ChangeRequest.aspx?ID='+cast(ChangeRequest.ChangeRequest_ID
    as nvarchar) +CHAR(34)+'>Open</a></center>',"

    I want to invoke a Client side javascript function and pass the value
    of the ID. How can I accomplish this such when a user clicks "Open" he
    goes to a new window with the same ID.

    I tried this but it does not work:
    On Server side:
    sSql = "SELECT DISTINCT " + "'Action' = '<center><a href= 'javascript:
    NewWindow('+cast(ChangeRequest.ChangeRequest_ID as nvarchar)+
    CHAR(34)+)'>Open</a></center>',"

    On Client side:
    function NewWindow(myID)
    {
    window.open("ChangeRequest.aspx?ID="+myID,"WindowName","width=500,height=600");
    }
    </script>
     
    Renuka, Nov 13, 2003
    #1
    1. Advertising

  2. "Renuka" wrote on 13/11/2003:

    > Hello,
    >
    > Can someone help me with the following situation??
    >
    > I have a Hyperlink within a String like below:
    >
    > sSql = "SELECT DISTINCT " + "'Action' = '<center><a
    >

    href='+char(34)+'ChangeRequest.aspx?ID='+cast(ChangeRequest.ChangeRequ
    est_ID
    > as nvarchar) +CHAR(34)+'>Open</a></center>',"
    >
    > I want to invoke a Client side javascript function and pass the

    value
    > of the ID. How can I accomplish this such when a user clicks "Open"

    he
    > goes to a new window with the same ID.
    >
    > I tried this but it does not work:
    > On Server side:
    > sSql = "SELECT DISTINCT " + "'Action' = '<center><a href=

    'javascript:
    > NewWindow('+cast(ChangeRequest.ChangeRequest_ID as nvarchar)+
    > CHAR(34)+)'>Open</a></center>',"
    >
    > On Client side:
    > function NewWindow(myID)
    > {
    >

    window.open("ChangeRequest.aspx?ID="+myID,"WindowName","width=500,heig
    ht=600");
    > }
    > </script>


    You are trying to launch a pop-up window with URL that is generated
    server-side. If so, have your server-side script produce this link:

    <A href="#"
    onclick="window.open('ChangeRequest.aspx?ID=INSERT-YOUR-ID-VALUE-HERE'
    , 'your-window-name', 'width=500,height=600')">Open</A>

    Mike

    --
    Michael Winter
    M.Winter@[no-spam]blueyonder.co.uk (remove [no-spam] to reply)
     
    Michael Winter, Nov 13, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Qw==?=
    Replies:
    1
    Views:
    3,256
    Hermit Dave
    Jan 16, 2004
  2. Shaul Feldman
    Replies:
    0
    Views:
    859
    Shaul Feldman
    Apr 16, 2004
  3. Guadala Harry
    Replies:
    4
    Views:
    1,528
    =?Utf-8?B?aGFyaSBwcmFzYWQ=?=
    Jun 15, 2004
  4. nick
    Replies:
    3
    Views:
    3,219
    Eliyahu Goldin
    Dec 15, 2004
  5. Good Man
    Replies:
    1
    Views:
    981
    Good Man
    Mar 3, 2006
Loading...

Share This Page