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:
Comments
Post a Comment