[CLOSED] ComboBox items Cls

  1. #1

    [CLOSED] ComboBox items Cls

    I noticed there are a lot of configuration attributes to set various styles for a combobox, but I can't find one to be applied to all the ListItem's in the combobox.

    What if I wanted all the items to be bold? Do I have to define a ListConfig and ItemTpl for something very simple?

    <ext:ComboBox runat="server"
       <Items>
          <ext:ListItem Text="Shade" />
          <ext:ListItem Text="Mostly Shady" />
          <ext:ListItem Text="Sun or Shade" />
          <ext:ListItem Text="Mostly Sunny" />
          <ext:ListItem Text="Sunny" />
       </Items>
    </ext:ComboBox>
    Last edited by Daniil; Nov 21, 2012 at 3:58 PM. Reason: [CLOSED]
  2. #2
    Hi Chris,

    I would achieve it this way.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.ComboBox1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "1", "Item 1" },
                    new object[] { "2", "Item 2" },
                    new object[] { "3", "Item 3" }
                };
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <style>
            .my-list .x-boundlist-item {
                font-weight: bold;
            }
        </style>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:ComboBox 
            ID="ComboBox1" 
            runat="server" 
            DisplayField="text" 
            ValueField="value"
            Cls="my-combobox">
            <Store>
                <ext:Store runat="server">
                    <Model>
                        <ext:Model runat="server">
                            <Fields>
                                <ext:ModelField Name="value" />
                                <ext:ModelField Name="text" />
                            </Fields>
                        </ext:Model>
                    </Model>
                    <Reader>
                        <ext:ArrayReader />
                    </Reader>
                </ext:Store>
            </Store>
            <ListConfig runat="server" Cls="my-list" />
        </ext:ComboBox>
    </body>
    </html>
  3. #3
    Perfect. I hadn't used the ListConfig before. Please close the thread.

Similar Threads

  1. Replies: 7
    Last Post: Feb 29, 2012, 11:53 AM
  2. [CLOSED] Combobox: How to remove the duplicate items in the combobox?
    By csssi_coolite in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 09, 2011, 9:34 AM
  3. Removing Items From Combobox
    By Rakeshkumar.a in forum 1.x Help
    Replies: 0
    Last Post: Jan 31, 2011, 12:10 PM
  4. Combobox Items bug ?
    By fabiomarcos in forum 1.x Help
    Replies: 3
    Last Post: Dec 26, 2008, 4:00 PM
  5. [CLOSED] Combobox items
    By fabiomarcos in forum 1.x Help
    Replies: 8
    Last Post: Dec 16, 2008, 9:16 AM

Posting Permissions