Dynamicaly build css rules

  1. #1

    Dynamicaly build css rules

    Hi everyone !

    Does someone know how to accomplish this:

    Hi,

    you can dynamicaly build css rules with predefined names and then use these dynamic css rules in renderer

    Vladimir Shcheglov
    Coolite Inc.

    This is the answer for my thread "http://forums.ext.net/showthread.php?threadid=10001-4-1.aspx" but I donĀ“t know how to "dynamicaly build css rules" from code behind.

    Thanks in advance.
  2. #2

    RE: Dynamicaly build css rules

    Check out your ScriptManager control; it has a method to apply new styles that you can predefine and use later in your page.

            this.ScriptManager1.Style.Add("blackBG", "color: white !important; background-color:black !important;");

    This will create an CSS style entry called blackBG that is accessible to everything. I hope this helps.

    -MC
  3. #3

    RE: Dynamicaly build css rules

    @mindcore1 - I'm not sure ScriptManager.Style.Add would work. I thought the .Style property was hidden. If it's not, it should be. The .Style property is a native asp.net property that we (purposely) ignore throughout the Toolkit.*

    I'll take another look at the @fabiomarcos question.


    Geoffrey McGill
    Founder
  4. #4

    RE: Dynamicaly build css rules

    Thanks, Geoffrey!

    You are right, the ScriptManager would just ignore the new entry.
  5. #5

    RE: Dynamicaly build css rules



    Sorry to bring this back but I have a similar question. On initial page load, I dynamically added a css style to the page. During an AjaxEvent, how can I modify that css style?

    For example, I created a style called MyColor {background-color:Red;}. During an AjaxEvent, I want to change the color to black so all elements with that css class will be affected.
  6. #6

    RE: Dynamicaly build css rules

    Hi,

    I think you need use
    http://extjs.com/deploy/dev/docs/?class=Ext.util.CSS


    createStyleSheet and updateRule


    If properly understood then updateRule can work with css rules defined in markup as well (I mean that createStyleSheet is not required for updateRule)
  7. #7

    RE: Dynamicaly build css rules

    Hi Jacky,

    It's best to start a new thread. Please post a cross link between the threads if you feel they are related.


    Geoffrey McGill
    Founder

Similar Threads

  1. Replies: 4
    Last Post: Jul 12, 2012, 2:29 PM
  2. Replies: 0
    Last Post: Sep 04, 2009, 1:07 AM
  3. [CLOSED] How to Add Controls in a Row dynamicaly on PageLoad?
    By juanpablo.belli@huddle.com.ar in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 09, 2009, 12:33 PM
  4. Desktop: Create new window dynamicaly
    By Nime in forum 1.x Help
    Replies: 17
    Last Post: Jan 28, 2009, 5:06 PM
  5. [CLOSED] Dynamicaly resize west pane with JS
    By testix in forum 1.x Help
    Replies: 2
    Last Post: Nov 24, 2008, 6:03 PM

Posting Permissions