|
-
Mar 2nd, 2006, 03:54 PM
#1
Thread Starter
Lively Member
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?
-
Mar 3rd, 2006, 10:02 AM
#2
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.
-
Mar 3rd, 2006, 10:35 AM
#3
Thread Starter
Lively Member
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.
-
Mar 3rd, 2006, 10:44 AM
#4
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.
-
Mar 6th, 2006, 09:19 AM
#5
Addicted Member
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 %>';
-
Mar 6th, 2006, 10:13 AM
#6
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|