Results 1 to 8 of 8

Thread: [CLOSED] How to initial selected item for combobox when its store is jsonstore?

  1. #1
    Member
    Join Date
    Oct 2008
    Location
    Posts
    62

    [CLOSED] How to initial selected item for combobox when its store is jsonstore?

    Hi,everyone!

    How to initial selected item for combobox when its store is jsonstore?

  2. #2
    Member
    Join Date
    Oct 2008
    Location
    Jerusalem
    Posts
    50

    RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?

    You could add a SelectedItem within the combo box body and set the value or text to the value you need to be selected, here's an example:

    Code:
      
     <ext:ComboBox StoreID="Store1" ID="ComboBox1" runat="server">
         <SelectedItem Value="1" />
         </ext:ComboBox>
    or by using text:

    Code:
      
    
     <ext:ComboBox StoreID="Store1" ID="ComboBox1" runat="server">
    
         <SelectedItem Text="UK" />
    
         </ext:ComboBox>
    hope this helps,

  3. #3
    Ext.NET - Dev Team Vladimir's Avatar
    Join Date
    Mar 2008
    Location
    Russia
    Posts
    15,335

    RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?

    Hi,

    May be I misunderstood you but the predefined selection does not depend on the store.

    Just set for combobox and selection will be set after store load
    Code:
    <SelectedItem Value="1" />
    Hope this help


    Vladimir Shcheglov
    Ext.NET, Inc.
    Development Team

    Ext.NET Examples | Ext.NET API Docs | ExtJS API Docs | Twitter | Jobs

  4. #4
    Member
    Join Date
    Oct 2008
    Location
    Jerusalem
    Posts
    50

    RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?

    that's what I said, but there is a problem I could not find a way to do it. How we can bind a value to the selected Item.
    if I use it like this
    Code:
    <SelectedItem Value='<%# Eval("Id") %>'/>
    this will throw this exception:

    Databinding
    expressions are only supported on objects that have a DataBinding
    event. Coolite.Ext.Web.ListItem does not have a DataBinding event.

    What we can do? is their anyway to do it without handling this situation it in the code?

  5. #5
    Member
    Join Date
    Oct 2008
    Location
    Posts
    62

    RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?

    Thank you!
    Maybe I should post my code here.

    html:
    Code:
                 <ext:Store runat="server" ID="stoDiv" AutoLoad="true">
                 <ext:Button ID="cmdFilDiv" runat="server" Text="Advance" Icon="ServerEdit">
    cs:
    in Page_Load()
    Code:
                 //initial store
               store = stoDiv;
               store.Reader.Clear();
                 // add JsonReader
                store.Reader.Add(t.Reader);
                store.Proxy.Clear();
                // add HttpProxy
                store.Proxy.Add(t.Proxy);
                store.AutoLoad = true;
    
                iniCombo(cboDiv);
                cboDiv.StoreID = storeID;//set store for combobox
    Now how to initialize selected item for combobox in codebehide? please help me. Thank you!

  6. #6
    Member
    Join Date
    Oct 2008
    Location
    Posts
    62

    RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?

    I want to set combobox's selected item to first item.

  7. #7
    Member
    Join Date
    Oct 2008
    Location
    Jerusalem
    Posts
    50

    RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?

    Â*It seem's that Combo box SelectedIndex will be avalible at 0.7 version, I am using 0.6 and their is no such property to set the selected index.
    Take a look at this post:Â*http://forums.ext.net/showthread.php...combobox+width

    hope this helps,



  8. #8
    Member
    Join Date
    Oct 2008
    Location
    Posts
    62

    RE: [CLOSED] How to initial selected item for combobox when its store is jsonstore?

    OK! Thank you!

Similar Threads

  1. Replies: 2
    Last Post: Sep 04, 2011, 4:51 PM
  2. Replies: 2
    Last Post: Oct 03, 2010, 12:06 PM
  3. [CLOSED] ComboBox set selected item value
    By pumpkin in forum 1.x Premium Help
    Replies: 1
    Last Post: Sep 27, 2009, 7:26 AM
  4. Get Combobox Selected item
    By yarlenvas in forum 1.x Help
    Replies: 3
    Last Post: Mar 08, 2009, 2:04 PM
  5. Get ComboBox Selected Item
    By speedstepmem3 in forum 1.x Premium Help
    Replies: 2
    Last Post: Nov 18, 2008, 9:50 AM

Posting Permissions