[CLOSED] Get Selected Combo Box without selected first

  1. #1

    [CLOSED] Get Selected Combo Box without selected first

    Hai..

    I have some case here. I create Form Edit using a combobox field.When i try to edit the form without change anything in combox, the return value from combobox is the text that display in combobox field but if i do a change combobox the value is return 1 or 0. My combo box value i set to 1 and 0 and the text value is something text. i attachment image above about my problem.

    This is my formpanel script aspx :
    <ext:FormPanel ID="frmPanel1" 
                                        runat="server" 
                                        Title="Personal Data" 
                                        BodyPadding="10"
                                        Layout="FormLayout">
                                        <Defaults>
                                            <ext:Parameter Name="LabelWidth" Value="75" Mode="Raw" />
                                        </Defaults>
                                        <Items>
                                            <ext:TextField ID="txtName" runat="server" FieldLabel="Name" AllowBlank="false" />
                                            <ext:TextField ID="txtRFID" runat="server" FieldLabel="RFID" AllowBlank="false" />
                                            <ext:ComboBox ID="type" 
                                                  runat="server"
                                                  Name="type"
                                                  EmptyText="Select Type..." 
                                                  FieldLabel="Type" ForceSelection="false">
                                                  <Items>
                                                        <ext:ListItem Text="Operator" Value="1" />
                                                        <ext:ListItem Text="Mechanic" Value="0" />
                                                  </Items>
                                            </ext:ComboBox>
                                            <ext:Checkbox ID="active" runat="server" FieldLabel="Active ? " />
                                            <ext:TextField ID="txtSMUHours" runat="server" FieldLabel="SMU Hours" />
                                        </Items>
                                    </ext:FormPanel>
    And this is the form data come in code behind :
    Dim employeeID As String = e.ExtraParams("SN")
            Dim ds As New DataSet
    
            ds = BL.blFMGetOperatorSelect(Me.Session("AuthState"), employeeID)
    
            For i = 0 To ds.Tables(0).Rows.Count - 1
                With ds.Tables(0).Rows(i)
                    txtName.Text = .Item(1)
                    txtRFID.Text = .Item(4)
                    type.SetValue(.Item(2)) <--- combo box value from
                    If (.Item(3)) Then
                        active.Checked = True
                    Else
                        active.Checked = False
                    End If
                    txtSMUHours.Text = .Item(10)
                End With
            Next
    thanks for your attention and support.

    Regards,
    Redi
    Attached Thumbnails Click image for larger version. 

Name:	combobox_value.jpg 
Views:	9 
Size:	61.4 KB 
ID:	7293  
    Last edited by Daniil; Dec 03, 2013 at 12:50 PM. Reason: [CLOSED]
  2. #2
    Hi @redi,

    I am pretty sure there is mismatching of types.

    These Values
    <ext:ListItem Text="Operator" Value="1" />
    <ext:ListItem Text="Mechanic" Value="0" />
    are strings.

    But here
    type.SetValue(.Item(2))
    I guess, a numeric type like int.

    Please try this:
    <ext:ListItem Text="Operator" Value="1" Mode="Raw" />
    <ext:ListItem Text="Mechanic" Value="0" Mode="Raw" />
    This way the Values will be rendered as int, not as strings.
  3. #3
    Hai Daniil,

    thanks for your answer. I try u'r solution but when i click details the combo box text turning to false or true text. How to change text false and true so i can keep display the text of my combo box its Operator or is Mechanic ?

    Regards,
    Redi
  4. #4
    Hmm, no idea.

    Please provide a full test case to reproduce.

Similar Threads

  1. [CLOSED] Combo box Set Selected items - Razor
    By MTSI in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Sep 07, 2012, 3:39 PM
  2. [CLOSED] Combo selected text
    By Adrian in forum 2.x Legacy Premium Help
    Replies: 13
    Last Post: Jan 31, 2012, 11:47 PM
  3. Replies: 6
    Last Post: Aug 25, 2011, 2:13 PM
  4. [CLOSED] Combo Clearing Selected Text in IE?
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 11, 2011, 11:51 AM
  5. Replies: 3
    Last Post: Aug 21, 2010, 5:26 AM

Posting Permissions