473,385 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to embed code-behind variable into html <meta> tag

Jay
Is it possible to use the <% %> tag to embed a variable from page_load into a
meta tag in the aspx source? Somehow I am not getting the value out of my
variable properly - probably not using quotes correctly or something simple,
but after a full day of trying every possible syntax under the sun, I hope
someone can help.

Page_Load:
this.myKeywords = "keyWordOne keyWordTwo keyWordThree";

aspx source:
<head runat="server">
<meta name="keyword" content="<%=myKeywords %>" id="metaKeyword"
runat="server" />
</head>

results (source at runtime):
<meta id="metaKeyword" name="keyword" content="<%=myKeywords %>" />

note, my problem is that the results should be the value in myKeywords, not
="<%=myKeywords %>" as shown above.
--
Thanks very much
Jay
Mar 29 '06 #1
2 2481
Hello Jay,

content='<%#myKeywords()%>'

Where myKeywords is the function, returning your data
J> Is it possible to use the <% %> tag to embed a variable from
J> page_load into a meta tag in the aspx source? Somehow I am not
J> getting the value out of my variable properly - probably not using
J> quotes correctly or something simple, but after a full day of trying
J> every possible syntax under the sun, I hope someone can help.
J>
J> Page_Load:
J> this.myKeywords = "keyWordOne keyWordTwo keyWordThree";
J> aspx source:
J> <head runat="server">
J> <meta name="keyword" content="<%=myKeywords %>" id="metaKeyword"
J> runat="server" />
J> </head>
J>
J> results (source at runtime):
J> <meta id="metaKeyword" name="keyword" content="<%=myKeywords %>" />
J> note, my problem is that the results should be the value in
J> myKeywords, not ="<%=myKeywords %>" as shown above.
J>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 30 '06 #2
Jay
Michael,
When you say to use a function, do you mean javascript? The only time I
have the value in the myKeywords variable is at Page_Load time. Are you
suggesting to use a function (or method for c#) with postback? How will the
method know what the value is (as Page_Load has already occurred)?
Rookie questions, sorry if this is the wrong group.
Thanks,
--
Jay
"Michael Nemtsev" wrote:
Hello Jay,

content='<%#myKeywords()%>'

Where myKeywords is the function, returning your data
J> Is it possible to use the <% %> tag to embed a variable from
J> page_load into a meta tag in the aspx source? Somehow I am not
J> getting the value out of my variable properly - probably not using
J> quotes correctly or something simple, but after a full day of trying
J> every possible syntax under the sun, I hope someone can help.
J>
J> Page_Load:
J> this.myKeywords = "keyWordOne keyWordTwo keyWordThree";
J> aspx source:
J> <head runat="server">
J> <meta name="keyword" content="<%=myKeywords %>" id="metaKeyword"
J> runat="server" />
J> </head>
J>
J> results (source at runtime):
J> <meta id="metaKeyword" name="keyword" content="<%=myKeywords %>" />
J> note, my problem is that the results should be the value in
J> myKeywords, not ="<%=myKeywords %>" as shown above.
J>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Mar 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Heejeong Lee | last post by:
I am going to begin following project Description of the project: One of the proposed ways of storing XML is to "shred" the structure of the XML document and insert it into a relational...
822
by: Turamnvia Suouriviaskimatta | last post by:
I 'm following various posting in "comp.lang.ada, comp.lang.c++ , comp.realtime, comp.software-eng" groups regarding selection of a programming language of C, C++ or Ada for safety critical...
53
by: Felix Kater | last post by:
Hi, when accessing the variables in a struct: What's the reason why in C you have -> and . instead of only . ? Are there cases in which the compiler couldn't figure out what to do? Felix
2
by: przemeq | last post by:
Hi all, I've spent last few hours trying to figure out the following: fetch a website using urllib2 filter out some of its content using SGMLParser decode result from p. 2. using charset as...
0
by: Algobardo | last post by:
Good morning, this is the first time i write on this forum because i googled and i've seen related post with no solution. I will expose briefly the problem. I'm using c# 3.5 and i'm trying using...
14
by: confusedfusion | last post by:
Not sure how many form submissions that have been lost over the years before I started but the company has a contact form that the required fields when validation fails the error message is going...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.