[CLOSED] when bind from panel with datasource MultiCombo control not work properly

  1. #1

    [CLOSED] when bind from panel with datasource MultiCombo control not work properly

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MultiComboBox.aspx.cs" Inherits="MultiComboBox" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript">
            var FromLoaded = function (store, records) {
                if (Ext.getCmp('fpnlEdit') != undefined) {
                    if (records.length > 0) {
                        fpnlEdit.form.loadRecord(records[0]);
                    }
                }
            };
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="RMS" runat="server" Namespace="">
        </ext:ResourceManager>
        <ext:Store ID="fpnlEdit_Store" runat="server">
            <Listeners>
                <Load Fn="FromLoaded" />
            </Listeners>
        </ext:Store>
        <ext:Viewport runat="server" ID="vpItemAdd" Layout="BorderLayout">
            <Items>
                <ext:FormPanel ID="fpnlEdit" runat="server" Border="false" ButtonAlign="Left" AutoScroll="true"
                    Title="Add Details" BodyPadding="50" Region="Center">
                    <Items>
                        <ext:FieldSet ID="FsEdit" runat="server" Border="false" Layout="FormLayout">
                            <Items>
                                <ext:MultiCombo ID ="ddlMulti" FieldLabel="Items" runat="server" EmptyText="Select" Name="EtextValue" SelectionMode="Selection">
                                    <Items>
                                        <ext:ListItem Text="Item 1" Value="1">
                                        </ext:ListItem>
                                        <ext:ListItem Text="Item 2" Value="2">
                                        </ext:ListItem>
                                        <ext:ListItem Text="Item 3" Value="3">
                                        </ext:ListItem>
                                        <ext:ListItem Text="Item 4" Value="4">
                                        </ext:ListItem>
                                        <ext:ListItem Text="Item 5" Value="5">
                                        </ext:ListItem>
                                    </Items>
                                </ext:MultiCombo>
                            </Items>
                        </ext:FieldSet>
                    </Items>
                </ext:FormPanel>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
    Server side binding code as below:
     DataTable dt = new DataTable();
     dt.Columns.Add("EtextValue", typeof(string));
     DataRow dr = dt.NewRow();
     dr["EtextValue"] = "1,4";
     dt.Rows.Add(dr); 
     fpnlEdit_Store.DataSource = dt;
     fpnlEdit_Store.DataBind();
    Its work in Ext.net 1.7 but not work in Ext.net 2.2.
    Last edited by Daniil; Aug 27, 2013 at 5:00 AM. Reason: [CLOSED]
  2. #2
    Store should contain model with fields. I don't see it in your example
  3. #3
    Quote Originally Posted by Vladimir View Post
    Store should contain model with fields. I don't see it in your example
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="MultiComboBox.aspx.cs" Inherits="MultiComboBox" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript">
            var FromLoaded = function (store, records) {
                if (Ext.getCmp('fpnlEdit') != undefined) {
                    if (records.length > 0) {
                        fpnlEdit.form.loadRecord(records[0]);
                    }
                }
            };
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="RMS" runat="server" Namespace="">
        </ext:ResourceManager>
        <ext:Store ID="fpnlEdit_Store" runat="server">
            <Model>
                <ext:Model runat="server">
                    <Fields>
                        <ext:ModelField Name="EtextValue">
                        </ext:ModelField>
                    </Fields>
                </ext:Model>
            </Model>
            <Listeners>
                <Load Fn="FromLoaded" />
            </Listeners>
        </ext:Store>
        <ext:Viewport runat="server" ID="vpItemAdd" Layout="BorderLayout">
            <Items>
                <ext:FormPanel ID="fpnlEdit" runat="server" Border="false" ButtonAlign="Left" AutoScroll="true"
                    Title="Add Details" BodyPadding="50" Region="Center">
                    <Items>
                        <ext:FieldSet ID="FsEdit" runat="server" Border="false" Layout="FormLayout">
                            <Items>
                                <ext:MultiCombo ID="ddlMulti" FieldLabel="Items" runat="server" EmptyText="Select"
                                    Name="EtextValue" SelectionMode="Selection">
                                    <Items>
                                        <ext:ListItem Text="Item 1" Value="1">
                                        </ext:ListItem>
                                        <ext:ListItem Text="Item 2" Value="2">
                                        </ext:ListItem>
                                        <ext:ListItem Text="Item 3" Value="3">
                                        </ext:ListItem>
                                        <ext:ListItem Text="Item 4" Value="4">
                                        </ext:ListItem>
                                        <ext:ListItem Text="Item 5" Value="5">
                                        </ext:ListItem>
                                    </Items>
                                </ext:MultiCombo>
                            </Items>
                        </ext:FieldSet>
                    </Items>
                </ext:FormPanel>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
    Server side Code as below:
    DataTable dt = new DataTable();
     dt.Columns.Add("EtextValue", typeof(string));
     DataRow dr = dt.NewRow();
     dr["EtextValue"] = "1,4";
     dt.Rows.Add(dr); 
     fpnlEdit_Store.DataSource = dt;
     fpnlEdit_Store.DataBind();
    When i dr["EtextValue"] = "1" its work properly but when dr["EtextValue"] = "1,4" more than one value its create issue in selection
    Please see the attached image.
    Attached Thumbnails Click image for larger version. 

Name:	Issue.png 
Views:	15 
Size:	9.4 KB 
ID:	6790  
  4. #4
    A MultiCombo's setValue expects an array of values, not a string.

    You can do it this way:
    records[0].data.EtextValue = records[0].data.EtextValue.split(",");
    fpnlEdit.form.loadRecord(records[0]);

Similar Threads

  1. Multicombo not selecting properly
    By antoreegan in forum 2.x Help
    Replies: 2
    Last Post: May 23, 2013, 11:00 AM
  2. Bind datasource from Nhibernate
    By thesti in forum 1.x Help
    Replies: 0
    Last Post: Apr 08, 2012, 10:44 AM
  3. [CLOSED] spotlight doesn't work properly with window control
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Nov 10, 2009, 2:43 PM
  4. Bind existing Grid to Client-Side datasource
    By Tbaseflug in forum 1.x Help
    Replies: 0
    Last Post: Oct 30, 2009, 5:46 PM
  5. Replies: 0
    Last Post: Feb 11, 2009, 3:05 AM

Posting Permissions