Running a script from C#

Discussion in 'ASP .Net' started by MW de Jager, May 23, 2005.

  1. MW de Jager

    MW de Jager Guest

    I am running a script from C#, but I need a returnvalue to be passed back to
    my code.

    I am currently using RegisterStartupScript, but this does not allow me to
    receive anything back from the java script. Any ideas on how to do this?

    Kind regards
    MW de Jager
    MW de Jager, May 23, 2005
    #1
    1. Advertising

  2. MW de Jager

    Hans Kesting Guest

    MW de Jager wrote:
    > I am running a script from C#, but I need a returnvalue to be passed
    > back to my code.
    >
    > I am currently using RegisterStartupScript, but this does not allow
    > me to receive anything back from the java script. Any ideas on how
    > to do this?
    > Kind regards
    > MW de Jager


    When you do a RegisterStartupScript (or RegisterClientScript), the script
    is added to the output that will be sent to the browser. Nothing is executed (yet).
    Only when the server-side is done, the html (containing your script) is
    sent to the browser, which then may execute that script.

    To get a return value, you could write the result to a hidden input (that you
    can read when the page is submitted again),
    or redirect to some special url, with that result in the querystring.

    Hans Kesting
    Hans Kesting, May 23, 2005
    #2
    1. Advertising

  3. MW de Jager

    MW de Jager Guest

    Hans, here is what I'm trying to do.

    I use RegisterStartupScript to run a javascript to do a showModalWindow.

    This works fine, but I cannot get to the result that is passed back,



    Hans,

    I'm trying to make a dialog box (webpage) that will allow me to send back a
    result like OK or Cancel etc.

    I call some javascript that does a showModalDialog which works just fine.

    Only problem is, I can't see the result in my C# code.

    Any ideas, or is there another way to do this?

    Kind regards
    MW

    "Hans Kesting" <> wrote in message
    news:...
    > MW de Jager wrote:
    >> I am running a script from C#, but I need a returnvalue to be passed
    >> back to my code.
    >>
    >> I am currently using RegisterStartupScript, but this does not allow
    >> me to receive anything back from the java script. Any ideas on how
    >> to do this?
    >> Kind regards
    >> MW de Jager

    >
    > When you do a RegisterStartupScript (or RegisterClientScript), the script
    > is added to the output that will be sent to the browser. Nothing is
    > executed (yet).
    > Only when the server-side is done, the html (containing your script) is
    > sent to the browser, which then may execute that script.
    >
    > To get a return value, you could write the result to a hidden input (that
    > you
    > can read when the page is submitted again),
    > or redirect to some special url, with that result in the querystring.
    >
    > Hans Kesting
    >
    >
    MW de Jager, May 23, 2005
    #3
  4. Patrick Olurotimi Ige, May 23, 2005
    #4
    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. Benjamin Rutt
    Replies:
    2
    Views:
    931
    Peter Hansen
    Dec 20, 2005
  2. Rajat
    Replies:
    3
    Views:
    689
    Jorgen Grahn
    Jan 8, 2010
  3. Replies:
    2
    Views:
    147
    Sean O'Halpin
    Dec 17, 2008
  4. Replies:
    4
    Views:
    183
    Josef Moellers
    Oct 27, 2007
  5. Replies:
    4
    Views:
    292
    ccc31807
    Jul 29, 2011
Loading...

Share This Page