MultiSelect Control values not getting selected

  1. #1

    MultiSelect Control values not getting selected

    Hi,

    I am using multiselect control. My declaration code is
    <ext:MultiSelect ID="mlProdPlace" PaddingSpec="0 50 0 50" runat="server" MultiSelect="true"
                            DisplayField="Field1" ValueField="Field2" FieldLabel="Production Places"
                            Width="500" Height="200" AllowBlank="false">
                            <Store>
                                <ext:Store runat="server">
                                    <Model>
                                        <ext:Model runat="server">
                                            <Fields>
                                                <ext:ModelField Name="Field1">
                                                </ext:ModelField>
                                                <ext:ModelField Name="Field2">
                                                </ext:ModelField>
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                        </ext:MultiSelect>
    i want to select a value at server side based on the data.I have written code like this in direct event

    mlProdPlace.SelectedItems.Add(new Ext.Net.ListItem { Text = objProjLoc.Field1, Value = Convert.ToString(objProjLoc.Field2) });
     mlProdPlace.UpdateSelectedItems();
    but it is not getting selected.

    Please help.

    Regards
    Rashid siddique
    Last edited by Daniil; Aug 11, 2014 at 6:29 AM. Reason: Please use [CODE] tags
  2. #2
    What I do is:

    combo.SelectedItem.Value = value;
    combo.UpdateSelectedItems();
    Being "value" the corresponding ValueField as string.

    I think you should also specify the data type and IDProperty in your store, like this:

                                        <ext:Model runat="server" IDProperty="Field1">
                                            <Fields>
                                                <ext:ModelField Name="Field1" Type="Int" />
                                                <ext:ModelField Name="Field2" Type="String" />
                                            </Fields>
                                        </ext:Model>
  3. #3
    Thanks ALobpreis for the reply

    I got the solution. I have used DropDownField.Setvalue() method, which dosent even require an UpdateSelectedItems method to be called.

Similar Threads

  1. Replies: 0
    Last Post: Oct 12, 2012, 10:45 AM
  2. [CLOSED] Add values to Multiselect manually
    By softmachine2011 in forum 2.x Premium Help
    Replies: 3
    Last Post: Jul 11, 2012, 8:09 AM
  3. Replies: 1
    Last Post: Mar 29, 2012, 9:18 PM
  4. Replies: 0
    Last Post: Apr 29, 2011, 8:37 PM
  5. Multiselect - Get Values and Update Store
    By Tbaseflug in forum 1.x Help
    Replies: 6
    Last Post: Jul 13, 2009, 3:24 PM

Tags for this Thread

Posting Permissions