access hidden object from java script

Discussion in 'ASP .Net' started by Jeff User, Jan 3, 2008.

  1. Jeff User

    Jeff User Guest

    hi all

    Using C#, .NET1.1.

    I need to pass a string of text to the final html output and then
    capture it with java script on the client side. I found that I can
    place my string in and then access a textbox or a label from the js,
    but only if the textbox or label is visible. If they are hidden (and
    then need to be) then they are not created in the html output.

    I also think I could access a hidden html INPUT tag, but, I dont know
    how to place my string of text in an html control from the C# code.

    Anyideas how I can hide a string of text from my C# and then get it
    using the js?

    Thanks
    Jeff
    Jeff User, Jan 3, 2008
    #1
    1. Advertising

  2. Jeff User

    Dina Guest

    On Jan 3, 9:25 am, Jeff User <> wrote:
    > hi all
    >
    > Using C#, .NET1.1.
    >
    > I need to pass a string of text to the final html output and then
    > capture it with java script on the client side. I found that I can
    > place my string in and then access a textbox or a label from the js,
    > but only if the textbox or label is visible. If they are hidden (and
    > then need to be) then they are not created in the html output.
    >
    > I also think I could access a hidden html INPUT tag, but, I dont know
    > how to place my string of text in an html control from the C# code.
    >
    > Anyideas how I can hide a string of text from my C# and then get it
    > using the js?
    >
    > Thanks
    > Jeff


    Jeff,

    Just place a html INPUT Hidden tag and use Runat="Server". This would
    expose the hidden Html control on the server side and u can access it
    just like any other server control. use the "Text" property on the
    server side to put in the value and use the "value" property in the
    JS.

    Hope this helps.

    Regards, Dina
    Dina, Jan 3, 2008
    #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. Rick
    Replies:
    3
    Views:
    8,092
    Alexey Smirnov
    Apr 13, 2010
  2. Eyal
    Replies:
    2
    Views:
    468
  3. SolarCanine
    Replies:
    2
    Views:
    251
    SolarCanine
    Sep 20, 2005
  4. Sira
    Replies:
    0
    Views:
    86
  5. RuthG
    Replies:
    5
    Views:
    577
    Michael J. Ryan
    Jun 18, 2009
Loading...

Share This Page