Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Inserting a property value into the meta tag

Inserting a property value into the meta tag

Scheduled Pinned Locked Moved ASP.NET
database
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JacquesDP
    wrote on last edited by
    #1

    Hi all, I'm loading the meta tag values form the database for the description and the keywords, but its not doing what I want it to. Currently I have the following Keywords being a property in codebehind, but if I view the source of the page when I run it, it displays the content of the tag as follows & lt%=Keywords %& lt No matter how long he who laughs last laughs, he who laughs first has a head start!

    S R 2 Replies Last reply
    0
    • J JacquesDP

      Hi all, I'm loading the meta tag values form the database for the description and the keywords, but its not doing what I want it to. Currently I have the following Keywords being a property in codebehind, but if I view the source of the page when I run it, it displays the content of the tag as follows & lt%=Keywords %& lt No matter how long he who laughs last laughs, he who laughs first has a head start!

      S Offline
      S Offline
      SHatchard
      wrote on last edited by
      #2

      You can use the headers property of the page to add information to meta tags, for example Dim meta as new HtmlMeta() meta.Keywords = "test, stuff" Header.Controls.Add(meta) Try taking a look at that and if you get any problems post back

      J 1 Reply Last reply
      0
      • J JacquesDP

        Hi all, I'm loading the meta tag values form the database for the description and the keywords, but its not doing what I want it to. Currently I have the following Keywords being a property in codebehind, but if I view the source of the page when I run it, it displays the content of the tag as follows & lt%=Keywords %& lt No matter how long he who laughs last laughs, he who laughs first has a head start!

        R Offline
        R Offline
        ridda786
        wrote on last edited by
        #3

        You can try it using a method that returns the keyword. public string GetKey() { return keywords; }

        1 Reply Last reply
        0
        • S SHatchard

          You can use the headers property of the page to add information to meta tags, for example Dim meta as new HtmlMeta() meta.Keywords = "test, stuff" Header.Controls.Add(meta) Try taking a look at that and if you get any problems post back

          J Offline
          J Offline
          JacquesDP
          wrote on last edited by
          #4

          Thanks for the reply, What I did was added the runat attr to the meta tag, and then in the code behind I just used metaId.Content and assign the property to that

          No matter how long he who laughs last laughs, he who laughs first has a head start!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups