+1-888-365-2779
Try Now
More in this section

Forums / Designing with Sitefinity / Css styles and div runat in UserControls

Css styles and div runat in UserControls

4 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    10 Aug 2010
    Link to this post
    Hi,

    If you use div's selector to apply Css styles in usercontrols, you need to duplicate your styles to allow to use the changed name generated by the server based in hierarchies. I use in many places RadMenu's and others servers controls added as Usercontrols. Of course you can use classes, but what is the better way to manage id in style sheets by css.?

    id="RadMenu5"
    id="TopMenu1_RadMenu5"
    id="ctl00_MenuLevel_ctl00_TopMenu1_RadMenu5"

    Some guys suggesting to use one id="<%# ID %>" at the top of usercontrol but what about RadMenu or RadTabs you can't. No other way using CSS?.

    Thanks for your tips.
    Romi
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    11 Aug 2010
    Link to this post
    Hello Pierre,

    In a stylesheet you can use the following syntax to style the div

    #DivID
    {
        width: 28%;
        float: right;  
        padding: 15px
    }


    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    11 Aug 2010
    Link to this post
    Hi Ivan,

    I ivan, your answer is very simplist. Yes you can, but no better way? One same UC in many levels. May be some frendly adapter in code.

    no added other more complexe samples
    #ctl00_MenuLevel_ctl00_TopMenu1_RadMenu5
    {
       float:left
    }
    #ctl00_TopMenu1_RadMenu5{
       float:left
    }
    #TopMenu1_RadMenu5
    {
       float:left
    }
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Aug 2010
    Link to this post
    Hello Pierre,

    When you drop your navigation control - say RadMenu you can set CssClass property of the control. Then in your theme stylesheet you should have the same classes.

    #DivID div.Menu1
    {
    }
     
    #DivID div.Menu2
    {  
    }
     
    #DivID div.Menu3
    {  
    }

    Using the ID of the control is not a good solution. The better option is working with css classes as shown above.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered