[CLOSED] How set default Value in Combox

  1. #1

    [CLOSED] How set default Value in Combox

    Hi
    We have problem with load default data value in combobox ...
    We use MVC ...load data
      public ActionResult getOdogovornaLicaList()
            {
                var data = new OdgovornoLiceDAO().List();
    
                StoreResult sr = new StoreResult(data);
                
                return sr;
            }
      <ext:ComboBox ID="ComboBoxProjekatVodja" 
                    runat="server"
                    FieldLabel="<%$ Resources:R, ProjekatVodja %>"
                    DisplayField="Ol_Ime"
                    ValueField="Ol_ID"
                    EmptyText="Izaberite odgovorno lice"
                    Editable="false"
                    ForceSelection="false"
                    SelectOnFocus="true" 
                    QueryMode="Local" AutoDataBind="true" >
                    <Store>
                        
                        <ext:Store ID="Store1" runat="server" AutoLoad="true">
                        <Proxy>
                            <ext:AjaxProxy Url="/OdgovornoLice/getOdogovornaLicaList"  > <%--StartParam="start" LimitParam="limit"--%>
                                <Reader>
                                    <ext:JsonReader Root="data" ></ext:JsonReader>
                                </Reader>
                            </ext:AjaxProxy>  
                        </Proxy>
                            <Model>
                                <ext:Model ID="Model1" runat="server" IDProperty="Ol_ID">
                                    <Fields>
                                        <ext:ModelField Name="Ol_Ime" />
                                        <ext:ModelField Name="Ol_ID" Type="Int" />
                                    </Fields>
                                </ext:Model>
                            </Model>
                        </ext:Store>
                    </Stor>
                </ext:ComboBox>
    some like
                    <SelectedItems>
                        <ext:ListItem Value="<%Model.VodjaProjekta_ID %>" Mode="Raw"></ext:ListItem>
                        
                    </SelectedItems>
    Last edited by Daniil; Nov 21, 2012 at 1:10 PM. Reason: [CLOSED]
  2. #2
    Hi @boris,

    This should work.
    <SelectedItems>
        <ext:ListItem Value="<%# Model.Value %>" Mode="Raw" AutoDataBind="true" />
    </SelectedItems>
  3. #3
    Thank you done solved problem :D
  4. #4
    Hi Daniil,

    <SelectedItems>
        <ext:ListItem Value="<%# Model.Value %>" Mode="Raw" AutoDataBind="true" />
    </SelectedItems>
    The Property Model.Value is from which component.

    In the Store - <Model> i dont find the property Value. I have a lot of problems with the ComboBox.
    Last edited by Daniil; Mar 04, 2013 at 12:44 PM. Reason: Please yse [CODE] tags
  5. #5
    Plese do not post in CLOSED threads, it is better to create new thread and include links to any required threads
    P.S. In that sample, Model is MVC model object is passed to MVC view

Similar Threads

  1. [CLOSED] Icon in a Combox
    By sisa in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 15, 2012, 4:27 PM
  2. Combox align
    By Yannis in forum 1.x Help
    Replies: 0
    Last Post: Nov 05, 2009, 1:26 PM
  3. [CLOSED] Need help with combox -
    By JD in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 26, 2009, 3:31 PM
  4. [CLOSED] combox value not set
    By Satyanarayana murthy in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 21, 2009, 12:29 PM
  5. combox
    By sunmooncm in forum 1.x Help
    Replies: 0
    Last Post: Apr 14, 2009, 2:36 PM

Tags for this Thread

Posting Permissions