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. Change border properties of ASCX from code-behind?

Change border properties of ASCX from code-behind?

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netwinformsquestion
4 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.
  • M Offline
    M Offline
    mittalpa
    wrote on last edited by
    #1

    Hi I am building a library of asp.net user controls which I am deriving from a custom UserControlBase class which further derives from actual UserControl class. Hierarchy looks like this : ASCX -> UserControlBase : UserControl I have this requirement to put a border around all the ASCX's. So, I thought if I can modify UserControlBase it will apply to all ASCXs. I tried following code in Page_Load of UserCOntrolBase but its not working

    this.Attributes.Add("style", "border-color:#FFFF66;border-width:4px;border-style:Dashed;");

    What should I do to make it work? Please advise. Thanks AJ

    Follow your goals, Means will follow you ---Gandhi---

    N C 2 Replies Last reply
    0
    • M mittalpa

      Hi I am building a library of asp.net user controls which I am deriving from a custom UserControlBase class which further derives from actual UserControl class. Hierarchy looks like this : ASCX -> UserControlBase : UserControl I have this requirement to put a border around all the ASCX's. So, I thought if I can modify UserControlBase it will apply to all ASCXs. I tried following code in Page_Load of UserCOntrolBase but its not working

      this.Attributes.Add("style", "border-color:#FFFF66;border-width:4px;border-style:Dashed;");

      What should I do to make it work? Please advise. Thanks AJ

      Follow your goals, Means will follow you ---Gandhi---

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      You should use CSS classes rather than hard code these values. When users ask to change it, and they will, it will be much easier. Create a div in the control to act as the border and set its properties not the control itself.


      I know the language. I've read a book. - _Madmatt

      N 1 Reply Last reply
      0
      • N Not Active

        You should use CSS classes rather than hard code these values. When users ask to change it, and they will, it will be much easier. Create a div in the control to act as the border and set its properties not the control itself.


        I know the language. I've read a book. - _Madmatt

        N Offline
        N Offline
        Nasri87
        wrote on last edited by
        #3

        Agree with Mark Nischalke, Css more easier

        1 Reply Last reply
        0
        • M mittalpa

          Hi I am building a library of asp.net user controls which I am deriving from a custom UserControlBase class which further derives from actual UserControl class. Hierarchy looks like this : ASCX -> UserControlBase : UserControl I have this requirement to put a border around all the ASCX's. So, I thought if I can modify UserControlBase it will apply to all ASCXs. I tried following code in Page_Load of UserCOntrolBase but its not working

          this.Attributes.Add("style", "border-color:#FFFF66;border-width:4px;border-style:Dashed;");

          What should I do to make it work? Please advise. Thanks AJ

          Follow your goals, Means will follow you ---Gandhi---

          C Offline
          C Offline
          carlecomm
          wrote on last edited by
          #4

          Hi,you can try like this: XXX.Style["border-color"] = "#FFFF66;border-width:4px;border-style:Dashed";

          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