asp.net - Passing dynamic variable in meta tag -


i trying declare dynamic meta content , try 2 different ways not working. kindly me. in advance.

i using code this

<meta name="description" content='<%#desc%>'/> 

and

<meta name="description" content="<%=desc%>"/> 

both code not working, declaring desc variable public in c# code

that won't work asp.net won't understand word you're providing variable or else , leave unused.

in asp.net variables used using @ at rate of sign. can use this:

@{     var desc = "this description"; }  /* , in body part, use variable */  <meta name="description" content="@desc"/> 

now @desc rendered variable. , you'll result.

you're new asp.net, need learn syntax of language first. please refer following link:

http://www.asp.net/web-pages


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -