Results 1 to 6 of 6

Thread: How do you send a variable to a HTML code?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    101

    How do you send a variable to a HTML code?

    I want to be able to send a variable from the sub procedure and send it to the html code for processing. Is it possible?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do you send a variable to a HTML code?

    You mean to JAVASCRIPT... not the HTML.

    Is it a global javascript variable or limited to a function? You can use Page.RegisterClientScriptBlock/RegisterStartupScript.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    101

    Re: How do you send a variable to a HTML code?

    The variable will be going the param tag between the object tag of the html page.

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do you send a variable to a HTML code?

    I see.

    In that case, what you want to do is to make the object tag runat=server. Then, access the INNERHTML property of the object, and add your value there (it's a string property so just add the tag)

    A better way would be to use a literal control and to write all the object tags, etc to the literal control.

  5. #5
    Addicted Member
    Join Date
    Mar 2005
    Posts
    142

    Re: How do you send a variable to a HTML code?

    The easiest way to get a codebehind variable into a Javascript variable that I've found is to declare the variable as Protected:
    Code:
    Protected MyStringVariable as String
    ...and then use ASP tags in the Javascript:
    Code:
    var MyJavascriptVariable = '<%= MyStringVariable %>';

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do you send a variable to a HTML code?

    He isn't talking about javascript. He's talking about param tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width