[CLOSED] Brand a like a <ext:ComboBox

  1. #1

    [CLOSED] Brand a like a


    Hi, I have a html <select><option /></select> that I want to have the same apperance as the <ext:ComboBox. Is that at all possible?

    Best regards
    Mikael Jürke

  2. #2

    RE: [CLOSED] Brand a like a
    Hi Mikael,

    You can use Transform property. See example

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>Comboboxes</title>
        <script runat="server">
            protected void CB_Select(object sender, AjaxEventArgs e)
            {
                this.ScriptManager1.AddScript("alert('Select: {0}-{1}');", this.ComboBox1.SelectedItem.Text, this.ComboBox1.SelectedItem.Value);
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Debug">     
            </ext:ScriptManager>
            
            <ext:ComboBox ID="ComboBox1" runat="server" 
                TypeAhead="true" 
                TriggerAction="All" 
                ForceSelection="true" 
                Width="135" 
                Transform="state" >        
                <AjaxEvents>
                    <Select OnEvent="CB_Select"></Select>
                </AjaxEvents>
            </ext:ComboBox>              
                  
            <select name="state" id="state">
                <option value="AL">Alabama</option>
                <option value="AK">Alaska</option>
                <option value="AZ" selected>Arizona</option> <%--if you need predefined selection then use 'selected'--%>
                <option value="AR">Arkansas</option>           
            </select>
            
            <ext:Button runat="server" AutoPostBack="true" Text="Postback"></ext:Button>
        </form>
    </body>
    </html>
    There is one issue which I noticed - the AutoPostBack doesn't work with Transform element. We will investigate it

  3. #3

    RE: [CLOSED] Brand a like a
    Hi!
    Thank, but I have my <select generated from the code behind, like this.
    
    
    
    <head id="Head1" runat="server">
    
    
    <title>Comboboxes</title>
    
    
    <script runat="server">
    
    
    protected override void OnInit(EventArgs e)
    
    
    {
    
    
    LoadData();
    
    
    lblTest.Html = "<select name='state' id='state'>" +
    
    
    "<option value='AL'>Alabama</option>" +
    
    
    "<option value='AK'>Alaska</option>" +
    
    
    "<option value='AZ' selected>Arizona</option>" +
    
    
    "<option value='AR'>Arkansas</option>" +
    
    
    "</select>";
    
    
    }
    
    
    </script>
    
    
    </head>
    
    
    <body>
    
    
    <form id="form1" runat="server">
    
    
    <ext:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Debug"> 
    
    
    </ext:ScriptManager>
    
    
    <ext:ComboBox ID="ComboBox1" runat="server" 
    
    
    TypeAhead="true" 
    
    
    TriggerAction="All" 
    
    
    ForceSelection="true" 
    
    
    Width="135" 
    
    
    Transform="state" > 
    
    
    </ext:ComboBox> 
    
    
     
    
    
    <ext:Label ID="lblTest" runat="server"></ext:Label>
    
    
    <ext:Button ID="Button1" runat="server" AutoPostBack="true" Text="Postback"></ext:Button>
    
    
    </form>
    
    
    </body>
    
    
    </html>
    This does not work, maybe you have some tweak to the code?

    Best regards
    Mikael Jürke

  4. #4

    RE: [CLOSED] Brand a like a
    Hi,

    The Transfer property should contain real DOM element. You can use Literal control and set generated select to Literal

            protected void Page_Init(object sender, EventArgs e)
            {
                StringBuilder sb = new StringBuilder(256);
                sb.Append("<select name=\"state\" id=\"state\">");
                sb.Append("<option value=\"AL\">Alabama</option>");
                sb.Append("<option value=\"AK\">Alaska</option>");
                sb.Append("<option value=\"AZ\" selected>Arizona</option>");
                sb.Append("<option value=\"AR\">Arkansas</option>");           
                sb.Append("</select>");
                this.Literal1.Text = sb.ToString();
            }
    
            <asp:Literal ID="Literal1" runat="server"></asp:Literal>

  5. #5

    RE: [CLOSED] Brand a like a


    Okay I see. Then I cant apply this solution to my code. I have a GridPanel and a <GetRowClass that I insert html data to from an object array. This html contains the <Select> that I want to brand. But that is probably not possible then?

    
    
    
    <View>
    
    
    <ext:GroupingView ID="GroupingView1" HideGroupedColumn="true" runat="server" >
    ...
    <GetRowClass Handler="rowParams.body = '' + record.data.HtmlData + ''; return 'x-grid3-row-expanded';" />
    </ext:GroupingView>
    </View>

    Best regards
    Mikael Jürke

  6. #6

    RE: [CLOSED] Brand a like a
    Hi Mikael,

    I am not sure possible it is or not. I think it is possible but need big work in javascript. If I find a solution then I let you know

  7. #7

    RE: [CLOSED] Brand a like a
    Ok, thanks anyway!

    /Mikael

Similar Threads

  1. Replies: 4
    Last Post: Nov 30, 2011, 5:25 AM
  2. Replies: 4
    Last Post: Sep 28, 2011, 8:57 AM
  3. [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
  4. Replies: 1
    Last Post: Apr 17, 2011, 1:21 PM
  5. Replies: 6
    Last Post: Mar 20, 2009, 5:39 PM

Posting Permissions