[CLOSED] Use UI themes in javascript

  1. #1

    [CLOSED] Use UI themes in javascript

    How can I embed the necessary UI css files if the button I want to set ui: 'success' is created in javascript?
    Last edited by Daniil; Nov 25, 2015 at 3:22 PM. Reason: [CLOSED]
  2. #2
    Hi @jchau,

    I am not 100% sure I've got the question correctly, but:

    Example
    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                string theme = X.ResourceManager.Theme.ToString().ToLowerInvariant();
                string ui = "-success";
                string rtl = X.ResourceManager.RTL ? "-rtl" : "";
                string pathEmbedded = string.Format("Ext.Net.Build.Ext.Net.uipack.{0}.ext-net-ui{1}{2}-embedded.css", theme, ui, rtl);
    
                X.ResourceManager.RegisterClientStyleInclude(pathEmbedded);
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            Ext.onReady(function () {
                Ext.create("Ext.button.Button", {
                    renderTo: Ext.getBody(),
                    ui: "success",
                    text: "Button"
                });
            });
        </script>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
    
    </body>
    </html>
    I took the registration CSS code from the AbstractComponent's RegisterUIResources.

Similar Threads

  1. Themes
    By khalidal in forum 2.x Help
    Replies: 1
    Last Post: Apr 14, 2014, 10:05 PM
  2. Themes
    By vedaantees in forum 1.x Help
    Replies: 1
    Last Post: Feb 03, 2011, 12:13 PM
  3. What about new Themes?
    By Tanielian in forum 1.x Help
    Replies: 2
    Last Post: Sep 03, 2010, 6:42 PM
  4. about themes
    By kiran malgi in forum 1.x Help
    Replies: 2
    Last Post: Mar 06, 2010, 12:35 AM
  5. Add New Themes
    By simonmicheal in forum 1.x Help
    Replies: 10
    Last Post: Sep 28, 2009, 4:46 PM

Posting Permissions