Problem when selecting in a combobox

Page 2 of 2 FirstFirst 12
  1. #11
    The data I bind are in post #3, and are good.

    In post #9, I give a combo that didn't work with all information needed (I think).
  2. #12
    The following example works correctly for me.

    Example Page
    <%@ Page Language="C#" %>
    
    <%@ 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>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:ComboBox 
                runat="server" 
                DisplayField="someDisplayField"
                ValueField="someValueField" 
                EmptyText="Please choose a value">
                <Store>
                    <ext:Store runat="server">
                        <Proxy>
                            <ext:HttpProxy Url="DataHandler.ashx" />
                        </Proxy>
                        <Reader>
                            <ext:JsonReader>
                                <Fields>
                                    <ext:RecordField Name="someValueField" Type="Int" />
                                    <ext:RecordField Name="someDisplayField" Type="String" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <Listeners>
                    <BeforeQuery Handler="delete queryEvent.combo.lastQuery;" />
                </Listeners>
            </ext:ComboBox>
        </form>
    </body>
    </html>
    Example HTTP Handler
    using System.Web;
    using Ext.Net;
    
    namespace Work
    {
        public class DataHandler : IHttpHandler
        {
            public void ProcessRequest(HttpContext context)
            {
                context.Response.Clear();
                context.Response.ContentType = "text/html";
                object data = new object[] 
                {
                    new 
                    {
                        someValueField = 1,
                        someDisplayField = "Item 1"
                    },
                    new 
                    {
                        someValueField = 2,
                        someDisplayField = "Item 2"
                    }
                };
                context.Response.Write(JSON.Serialize(data));
                context.Response.Flush();
            }
    
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
        }
    }
  3. #13
    Yes, for me too, but it is my 2 combobox that did not work.

    I made a lot of them in another projects and I never had this kind of problem. I really not understand what happened on this 2 particular combo...Is it a way I could enter into the javascript code during execution to see what hapened when I select a vaule?
  4. #14
    Just to try, I change the json return :

    Here the new store :

    <ext:Store ID="stoEntities" runat="server">
        <DirectEventConfig Json="false" ShowWarningOnFailure="False">
            <EventMask ShowMask="true" />
        </DirectEventConfig>
        <Proxy>
            <ext:HttpProxy Url="jsonDAL/ReturnJsonWorldRegion.aspx" Json="false" Timeout="3000">
            </ext:HttpProxy>
        </Proxy>
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="INT_idRmdEntities" Type="Int" Mapping="INT_idWorldRegion" />
                    <ext:RecordField Name="STR_EntityName" type="String" mapping="STR_NameWorldRegion"/>
                </Fields>
            </ext:JsonReader>
        </Reader>        
    </ext:Store>
    I change nothing in the combo definition

    The JSON data returned :

    [{"INT_idWorldRegion":4,"STR_NameWorldRegion":"Africa"},{"INT_idWorldRegion":2,"STR_NameWorldRegion":"America"},{"INT_idWorldRegion":3,"STR_NameWorldRegion":"Asia-Pacifique"},{"INT_idWorldRegion":1,"STR_NameWorldRegion":"Europe"}]
    And here, the combobox works as usual....So, problem seems to be in data returned but I'm not able to understand what happened.
  5. #15
    Hello

    Problem solved.

    i came from the definition of the field in the database.

    Text field was 255 char longs, and apprently with that size, the serialize function put a carriage return in the JSON file that conduct to a JSON file misformated. I reduce the length of my field and all works well.

    You can close the thread.

    Thanks for your help.
  6. #16
    Thanks for the update, it can help someone on the forums in the future.
  7. #17
    Yes, I hope, BTW, it is very frustrating for me to see a thread solved with only "I found the problem, please close the thread" with no explanation on how the guy has solved it, a forum is made for helping people to find a solution and not to asks more question.
  8. #18
    Agree with you.
Page 2 of 2 FirstFirst 12

Similar Threads

  1. [CLOSED] Problem selecting items in Combobox
    By tlfdesarrollo in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 17, 2012, 6:57 PM
  2. Selecting value from ComboBox after binding
    By alexp in forum 1.x Help
    Replies: 0
    Last Post: Mar 30, 2011, 9:48 AM
  3. ComboBox Selecting Value using Text
    By speddi in forum 1.x Help
    Replies: 2
    Last Post: Apr 19, 2010, 3:11 AM
  4. combobox item selecting bug ! please help
    By relativ in forum 1.x Help
    Replies: 0
    Last Post: Nov 24, 2009, 4:31 AM
  5. Replies: 6
    Last Post: Mar 20, 2009, 5:39 PM

Posting Permissions