Calling a javascript function from server script URGENT HELP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Silvia Brunet-Jones

    #1

    Calling a javascript function from server script URGENT HELP

    Ok I am about to pull my hair.
    I have an active x control in an object tag which, as you
    know cant have runat=server. So what I need is to not
    loose what is in this box everytime a postback happens. So
    all I want to do is add this statement
    document.all.tx tEditor.value =
    document.all.Tr anscription.obj Editor.textrtf;
    in the before the page is posted so that I can then
    retrive it and put it back.
    WHY CANT I DO THIS!!!!!!!!!!! !
    I have tried all kinds of things, the submit function is
    not getting called when the postback occurs.
    There has to be a way how to call a javascript function
    from the server side code. Where I can put this in the
    private void Page_Unload(obj ect sender, System.EventArg s e)
    at least.
    HELP
  • Kevin Spencer

    #2
    Re: Calling a javascript function from server script URGENT HELP

    Actually, you CAN have a client-side <OBJECT> tag and a runat=server
    attribute. You just use an HTMLGenericCont rol in your CodeBehind to work
    with it.

    While you can't CALL a JavaScript function from the server side, you can
    certainly ADD one to the Page, using RegisterClientS criptBlock or
    RegisterStartup Script (if you want the script to run immediately after the
    page is loaded).

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    All hotels in Benidorm. The best selection of Benidorm hotels with reviews and maps. Book in advance and save.

    Big things are made up of
    lots of little things.

    "Silvia Brunet-Jones" <sbrunet_jones@ hotmail.com> wrote in message
    news:35fb01c355 4d$fcdc88e0$a00 1280a@phx.gbl.. .[color=blue]
    > Ok I am about to pull my hair.
    > I have an active x control in an object tag which, as you
    > know cant have runat=server. So what I need is to not
    > loose what is in this box everytime a postback happens. So
    > all I want to do is add this statement
    > document.all.tx tEditor.value =
    > document.all.Tr anscription.obj Editor.textrtf;
    > in the before the page is posted so that I can then
    > retrive it and put it back.
    > WHY CANT I DO THIS!!!!!!!!!!! !
    > I have tried all kinds of things, the submit function is
    > not getting called when the postback occurs.
    > There has to be a way how to call a javascript function
    > from the server side code. Where I can put this in the
    > private void Page_Unload(obj ect sender, System.EventArg s e)
    > at least.
    > HELP[/color]


    Comment

    Working...