[CLOSED] ComboBox - select default value

  1. #1

    [CLOSED] ComboBox - select default value

    Hi,
    I need to set the default combobox value

    I have easy example:
    <ext:ComboBox ID="cmbZakazPrestupu" runat="server">
            <Items>
                <ext:ListItem Text="NO" Value="0" />
                <ext:ListItem Text="YES" Value="1" />
            </Items>
            <SelectedItems>
                <ext:ListItem Index="1"></ext:ListItem>
            </SelectedItems>
    </ext:ComboBox>
    but:

    protected void buttonTest_Click(object sender, DirectEventArgs e)
    {
      string valueTest = this.cmbZakazPrestupu.SelectedItem.Value           
    }
    "valueTest" is always "1" = "YES" (default value),

    When I delete:
    <SelectedItems>
    <ext:ListItem Index="1"></ext:ListItem>
    </SelectedItems>
    everything is alright, but I have not set default value.

    In version 2, it worked.

    Thank you for your help
    Last edited by Daniil; Dec 19, 2015 at 9:40 AM. Reason: [CLOSED]
  2. #2
    Hi @nikisbeta,

    Please provide a full standalone test case.

    The test case below appears to be working as expected. It sets the default value and submit correct values.

    Example
    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Submit(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("Submit", this.ComboBox1.SelectedItem.Value + " : " + this.ComboBox1.SelectedItem.Text).Show();
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v3 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:ComboBox ID="ComboBox1" runat="server">
                <Items>
                    <ext:ListItem Text="NO" Value="0" />
                    <ext:ListItem Text="YES" Value="1" />
                </Items>
                <SelectedItems>
                    <ext:ListItem Index="1" />
                </SelectedItems>
            </ext:ComboBox>
    
            <ext:Button runat="server" Text="Submit" OnDirectClick="Submit" />
        </form>
    </body>
    </html>
  3. #3
    Hi,
    Thank you for your response.
    My page had conflict with another JS,
    everything is okay,
    sorry

Similar Threads

  1. [CLOSED] Problem with combobox when select a data from another combobox
    By opendat2000 in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 25, 2015, 6:24 PM
  2. Replies: 3
    Last Post: Nov 02, 2013, 1:01 AM
  3. [CLOSED] combox select first listitem default ?
    By hdsoso in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 15, 2013, 10:11 AM
  4. [CLOSED] By default select the first item in multiselect control
    By AnulekhaK in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 28, 2012, 11:30 AM
  5. ComboBox - Add Default Item
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Feb 03, 2009, 3:26 PM

Tags for this Thread

Posting Permissions