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
  1. Home
  2. Web Development
  3. ASP.NET
  4. HtmlTextWriter

HtmlTextWriter

Scheduled Pinned Locked Moved ASP.NET
csharpcssasp-nettutorial
6 Posts 4 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.
  • T Offline
    T Offline
    Tomas Petricek
    wrote on last edited by
    #1

    Hi, i need to paste CSS style definition to my Asp.Net control (in Render() method), but i think, that <style>...</style> should be between <head> and </head> :confused: i don't know how to insert my code into <head> Thank you

    R A L T 4 Replies Last reply
    0
    • T Tomas Petricek

      Hi, i need to paste CSS style definition to my Asp.Net control (in Render() method), but i think, that <style>...</style> should be between <head> and </head> :confused: i don't know how to insert my code into <head> Thank you

      R Offline
      R Offline
      Ruxo Zheng
      wrote on last edited by
      #2

      I don't think there's the way to do that. For myself I put the <STYLE> tag directly in .aspx file. However, you can use ASP display tag <%=%> to put the style text in the header. By declaring a protected/public variable in your code-behind file and place that variable (with ASP display tag) in between <HEAD> tag in .aspx file. That should work... :) Ruxo Zheng

      1 Reply Last reply
      0
      • T Tomas Petricek

        Hi, i need to paste CSS style definition to my Asp.Net control (in Render() method), but i think, that <style>...</style> should be between <head> and </head> :confused: i don't know how to insert my code into <head> Thank you

        A Offline
        A Offline
        Andy Smith
        wrote on last edited by
        #3

        ... MyStyle.InnerText = "The Css Rules You Want"; ...

        1 Reply Last reply
        0
        • T Tomas Petricek

          Hi, i need to paste CSS style definition to my Asp.Net control (in Render() method), but i think, that <style>...</style> should be between <head> and </head> :confused: i don't know how to insert my code into <head> Thank you

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          Here what I have in my templete page and it worx great for me, no designer support, but it works.

          protected override void OnInit(EventArgs e)
          {
          LiteralControl cont = (LiteralControl) Controls[0];
          int headend = cont.Text.LastIndexOf("");
          string css = "".Replace("'","\"");
          cont.Text = cont.Text.Insert(headend, css);
          cont.Text = cont.Text.Replace("

          AS you can see I have a header and a footer control on each page, also a drop all controls from the inherited page, into the a panel.

          Hope this helps :)

          "I dont have a life, I have a program." Also, I won't support any software without the LeppieRules variable.

          1 Reply Last reply
          0
          • T Tomas Petricek

            Hi, i need to paste CSS style definition to my Asp.Net control (in Render() method), but i think, that <style>...</style> should be between <head> and </head> :confused: i don't know how to insert my code into <head> Thank you

            T Offline
            T Offline
            Tomas Petricek
            wrote on last edited by
            #5

            Thank you all. I think, that i can't change existing generated code in control derived from System.Web.UI.WebControls.WebControl. But when i insert <style>...</style> into <body>..</body> it works fine :cool:

            L 1 Reply Last reply
            0
            • T Tomas Petricek

              Thank you all. I think, that i can't change existing generated code in control derived from System.Web.UI.WebControls.WebControl. But when i insert <style>...</style> into <body>..</body> it works fine :cool:

              L Offline
              L Offline
              leppie
              wrote on last edited by
              #6

              Thats why I rather suggested a site-wide templated Page derived class. :) Not just for CSS but menus headers, ads, footers, frames, etc :) "I dont have a life, I have a program." Also, I won't support any software without the LeppieRules variable.

              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