Change a css property in code behind

Last post 11-18-2008 7:44 PM by sappidireddy. 3 replies.

Sort Posts:

  • Change a css property in code behind

    11-18-2008, 2:46 PM

    Hi

    A user control has a grid view control that takes a style sheet. This user control is placed in many forms. The text in the grid has to become underlined only if the control is placed one particular page. How do i change the text-underline programmatically. Thanks

    Glora
  • Re: Change a css property in code behind

    11-18-2008, 5:34 PM
    Answer
    • All-Star
      36,188 point All-Star
    • rtpHarry
    • Member since 10-01-2006, 8:51 AM
    • Lincoln, England
    • Posts 5,818

     You can create a named skin using asp themes:


    Or you can set styles programatically by accessing GridView1.Style

  • Re: Change a css property in code behind

    11-18-2008, 7:33 PM
    Answer
    • Contributor
      4,421 point Contributor
    • BrianOConnell
    • Member since 08-04-2002, 4:24 PM
    • Dublin, Ireland
    • Posts 828

    Not sure hwo you are styling your gridview. As it's a table I would normally have something along these lines:-

    table {
       width:90%
    }
    table td   {
       font-size:80%;
    }

    etc.

    Now if I want my text underlined in one page only then I would put a class value in the body of the page - <body class="underlinegridtext"> and my style would be:-

    body.underlinegridtext table td   {
       text-decoration:underline;
    }

    Brian O'Connell (MCAD) - http://www.systemdotweb.com
  • Re: Change a css property in code behind

    11-18-2008, 7:44 PM
    • Participant
      895 point Participant
    • sappidireddy
    • Member since 10-25-2007, 3:32 AM
    • Posts 211

    create a property  for style  in the usercontrol and assign style property from your page...

    Thanks,
    Venkat
    Dont forget to click "Mark as Answer" on the post that helped you
Page 1 of 1 (4 items)