[CLOSED] Ext Combobox - Selected value changed from code behind on postback event is not reflected on the UI

  1. #1

    [CLOSED] Ext Combobox - Selected value changed from code behind on postback event is not reflected on the UI

    I have an Ext.Net combobox. I am using version 2 of Ext.Net and v4.0 of .Net

    On a particular event, I am setting its value from javascript.

     
                    Ext.getCmp('ddlCountryOfRisk_ddl').store.clearFilter();
                    Ext.getCmp('ddlCountryOfRisk_ddl').store.load();
                    Ext.getCmp('ddlCountryOfRisk_ddl').clearValue();
                    Ext.getCmp('ddlCountryOfRisk_ddl').setValue(cntry);
                    Ext.getCmp('ddlCountryOfRisk_ddl').readOnly = true;
    Now if I am trying to change the selected value from the code behind on a postback event, this changed value is not showing back on the UI.

     
     ddlCountryOfRisk.ReadOnly = false; 
     ddlCountryOfRisk.SelectedValue = value;

    The same issue occurs if I change the value from UI and then try to set it from code behind on post back event.


    Please assist me.
    Last edited by Daniil; Nov 11, 2014 at 5:40 PM. Reason: [CLOSED]
  2. #2
    Hi @Maitreya,

    Please provide a full test case to reproduce the issue.
  3. #3
    I have a form which contains a combobox and a gridpanel into it.

    RowEditing direct event of the GridPanel, I am calling a method which sets the selected value for the combobox.

     
    
    <Plugins>
                    <ext:RowEditing ID="reOwner" runat="server" ClicksToEdit="2" CommitChangesText="You need to cancel or commit your changes" SaveHandler="ValidateAddParent">
                        <Listeners>
                            <BeforeEdit Fn="EnableOwnershipEditors" />
                            <CancelEdit Fn="EditOwnershipCancelled" />
                        </Listeners>
                        <DirectEvents>
                            <Edit OnEvent="RecordEdited" Before="insertOwner = false;" After="EnableAddButton(#{reOwner});SetUltimateParent();">
                                <ExtraParams>
                                    <ext:Parameter Name="Values" Value="Ext.encode(GetModifiedValues(#{pnlOwnership}))"
                                        Mode="Raw" />
                                </ExtraParams>
                                <EventMask ShowMask="true" CustomTarget="#{pnlOwnership}" />
                            </Edit>
                        </DirectEvents>
                    </ext:RowEditing>
                </Plugins>

    Code Behind:

     
    
    protected void RecordEdited(object sender, DirectEventArgs e)
            {
                var json = e.ExtraParams["Values"];
               
                .... 
    
    
               ddlCountryOfRisk.SelectedItem.Value = value
               ...
                
                }
            }
    This selected value set on the direct event is not reflected on the UI.
    Last edited by Maitreya; Nov 04, 2014 at 5:00 AM.
  4. #4
    Hi

    If you need to change selected value in combo during direct event then use the following code
    this.ComboBox2.SelectedItems.Clear();
    this.ComboBox2.SelectedItems.Add(new Ext.Net.ListItem { Value = "0" });
    this.ComboBox2.UpdateSelectedItems();
    It is demonstrated in the following online example
    https://examples2.ext.net/#/Form/Com...Items_Actions/

Similar Threads

  1. [CLOSED] Postback does not send combobox's selected value
    By Maitreya in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Sep 26, 2014, 12:07 PM
  2. Replies: 0
    Last Post: Sep 03, 2014, 7:08 AM
  3. Replies: 1
    Last Post: Dec 20, 2012, 7:30 AM
  4. Replies: 4
    Last Post: Jun 28, 2012, 11:32 PM
  5. [CLOSED] ComboBox repopulated in code behind, not reflected on page
    By ewgoforth in forum 1.x Legacy Premium Help
    Replies: 15
    Last Post: Nov 23, 2010, 9:03 PM

Posting Permissions