[CLOSED] Suddenly Dynamic ComboBox Component stopped working after 3 months of smooth work!!!!

Page 2 of 2 FirstFirst 12
  1. #11
    Hi,

    I cannot reproduce the issue, here is my test case are based on your attachment
    <%@ Page Language="C#" %>
    <%@ Import Namespace="System.Collections.Generic" %>
    <%@ Import Namespace="System.ComponentModel" %>
    <%@ 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 runat="server">
            public class TestSelector : FormPanel
            {
                #region Private Members
    
                private readonly ComboBox ddlReportsList = new ComboBox();
                private Ext.Net.Panel pnlParameters = new Ext.Net.Panel();
                private List<ReportParam> paramters;
    
                #endregion
    
                #region Public Properties
    
    
                /// <summary>
                /// Collection of Shared Parameters applied for all reports
                /// </summary>
                [Category("Behavior")]
                [Description("Collection of Shared Reports Parameters")]
                [NotifyParentProperty(true)]
                [PersistenceMode(PersistenceMode.InnerProperty)]
                [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
                public List<ReportParam> Parameters
                {
                    get
                    {
                        if (paramters == null)
                        {
                            paramters = new List<ReportParam>();
                            //if (IsTrackingViewState)
                            //{
                            //    ((IStateManager)paramters).TrackViewState();
                            //}
                            var xf = new ReportParam
                            {
                                DBTableName = "BookingOrders",
                                DisplayField = "bookingOrderNo",
                                IsRequired = true,
                                ValueField = "bookingOrderId",
                                Label = "Booking Order No",
                                Name = "bookingOrderId"
                            };
                            paramters.Add(xf);
                        }
                        return paramters;
                    }
                }
    
    
                /// <summary>
                /// Gets the Report Parameters Container Panel
                /// </summary>
                public Ext.Net.Panel ReportParametersPanel
                {
                    get
                    {
                        return this.pnlParameters;
                    }
                }
    
    
                /// <summary>
                /// Width applied on the Reports List drop down.
                /// </summary>
                public Unit ReportParametersPanelWidth
                {
                    get
                    {
                        return this.pnlParameters.Width;
                    }
                    set
                    {
                        if (this.pnlParameters != null)
                            this.pnlParameters.Width = value;
                    }
                }
    
                ///// <summary>
                /// Height applied on the Reports List drop down.
                /// </summary>
                public Unit ReportsListHeight
                {
                    get
                    {
                        return this.ddlReportsList.Height;
                    }
                    set
                    {
                        this.ddlReportsList.Height = value;
                    }
                }
    
    
    
                /// <summary>
                /// Server-side DirectEvent handler. Method signature is (object sender, DirectEventArgs e).
                /// </summary>
                [Description("Server-side DirectEvent handler. Method signature is (object sender, DirectEventArgs e).")]
                public event Ext.Net.ComponentDirectEvent.DirectEventHandler ReportChanged
                {
                    add
                    {
                        this.ddlReportsList.DirectEvents.Change.Event += value;
                    }
                    remove
                    {
                        this.ddlReportsList.DirectEvents.Change.Event -= value;
                    }
                }
                /// <summary>
                /// Server-side DirectEvent handler. Method signature is (object sender, DirectEventArgs e).
                /// </summary>
                [Description("Server-side DirectEvent handler. Method signature is (object sender, DirectEventArgs e).")]
                public event Ext.Net.ComponentDirectEvent.DirectEventHandler ReportSelected
                {
                    add
                    {
                        this.ddlReportsList.DirectEvents.Select.Event += value;
                    }
                    remove
                    {
                        this.ddlReportsList.DirectEvents.Select.Event -= value;
                    }
                }
    
    
                #endregion
    
                #region Protected Methods
                /// <summary>
                /// Control initialization, first step in object life cycle
                /// </summary>
                /// <param name="e"></param>
                protected override void OnInit(EventArgs e)
                {
                    base.OnInit(e);
                    InitControls();
                    CreateReportsList();
                    this.Items.Add(ddlReportsList);
                    this.Items.Add(pnlParameters);
                }
    
                /// <summary>
                /// Load control, second step in object life cycle
                /// </summary>
                /// <param name="e">Load event args</param>
                protected override void OnLoad(EventArgs e)
                {
                    base.OnLoad(e);
                    this.pnlParameters.RemoveAll();
                    CreateReportParameters();
                }
    
                #endregion
    
                #region Internal Help Functions
    
                /// <summary>
                /// Initialize controls settings and set their ids
                /// </summary>
                private void InitControls()
                {
                    this.EnableViewState = false;
                    this.ID = "pnlReportSelection";
                    this.Title = "Select Report";
                    this.Frame = true;
                    this.Padding = 5;
                    this.Width = new Unit(300, UnitType.Pixel);
    
    
                    this.pnlParameters.ID = "pnlReportParameters";
                    this.pnlParameters.Layout = "Form";
                    this.pnlParameters.LabelWidth = 120;
                    this.pnlParameters.PaddingSummary = "10px 0px 0px 0px";
    
                }
    
                /// <summary>
                /// Create Reports dropdownlist based on Reports Collection
                /// </summary>
                private void CreateReportsList()
                {
                    this.ddlReportsList.ID = "rL";
                    this.ddlReportsList.FieldLabel = "Report Name";
                    this.ddlReportsList.EmptyText = "Please Select Report";
                    this.ddlReportsList.Title = "Please Select Report";
                    this.ddlReportsList.AllowBlank = false;
                    this.ddlReportsList.BlankText = "Report Selection is required";
                    this.ddlReportsList.TypeAhead = true;
                    this.ddlReportsList.SelectOnFocus = true;
                    this.ddlReportsList.AnchorHorizontal = "95%";
                    this.ddlReportsList.LabelWidth = 80;
                    this.ddlReportsList.DirectEvents.Select.EventMask.ShowMask = true;
                    this.ddlReportsList.DirectEvents.Select.EventMask.Msg = "Loading Report Parameters, please wait...";
    
    
                    this.ddlReportsList.Items.Add(new Ext.Net.ListItem("Dummy Report 1", "Rpt1Value"));
                    this.ddlReportsList.Items.Add(new Ext.Net.ListItem("Dummy Report 2", "Rpt2Value"));
                    this.ddlReportsList.Items.Add(new Ext.Net.ListItem("Dummy Report 3", "Rpt3Value"));
    
                }
    
    
                /// <summary>
                /// Create fixed and shared report parameters 
                /// </summary>
                private void CreateReportParameters()
                {
                    var r = ddlReportsList.SelectedItem.Text;
                    if (!String.IsNullOrEmpty(r) && r == "Dummy Report 3")
                    {
                        if (this.Parameters.Count > 0)
                        {
                            var c = new Ext.Net.Label();
                            c.ID = "lblTitle";
                            c.FieldLabel = "Report Parameters";
                            c.LabelSeparator = "";
                            c.LabelStyle = "color:green;font-weight:bold;";
                            c.Render(this.pnlParameters, Ext.Net.RenderMode.AddTo);
                        }
                        foreach (ReportParam param in this.Parameters)
                        {
                            CreateParamter(param);
                        }
                    }
                }
    
                /// <summary>
                /// Main method for creating each parameters depending on its type
                /// </summary>
                /// <param name="param">Parameter to be created</param>
                private void CreateParamter(ReportParam param)
                {
    
                    Ext.Net.ComboBox ddl = new Ext.Net.ComboBox();
                    ddl.LoadingText = "refreshing ...";
    
                    ddl.DisplayField = param.DisplayField;
                    ddl.ValueField = param.ValueField;
    
                    var x = new Ext.Net.Store();
                    x.ID = String.Format("{0}_stoId", param.Name);
                    x.AutoLoad = false;
                    Ext.Net.HttpProxy storeProxy = new Ext.Net.HttpProxy();
                    storeProxy.Json = true;
                    storeProxy.Method = Ext.Net.HttpMethod.POST;
                    ddl.PageSize = 50;
                    x.AutoLoadParams.Add(new Ext.Net.Parameter("start", "0", Ext.Net.ParameterMode.Value));
                    x.AutoLoadParams.Add(new Ext.Net.Parameter("limit", "50", Ext.Net.ParameterMode.Value));
                    x.BaseParams.Add(new Ext.Net.Parameter("dbTableName", param.DBTableName, Ext.Net.ParameterMode.Value));
                    x.BaseParams.Add(new Ext.Net.Parameter("valueField", param.ValueField, Ext.Net.ParameterMode.Value));
                    x.BaseParams.Add(new Ext.Net.Parameter("displayField", param.DisplayField, Ext.Net.ParameterMode.Value));
                    x.BaseParams.Add(new Ext.Net.Parameter("additionalColumns", "", Ext.Net.ParameterMode.Value));
                    x.BaseParams.Add(new Ext.Net.Parameter("pageSize", ddl.PageSize.ToString(), Ext.Net.ParameterMode.Value));
                    storeProxy.Url = "Services/GenericService.asmx/LoadComboBoxData";
                    x.Proxy.Add(storeProxy);
                    Ext.Net.JsonReader reader = new Ext.Net.JsonReader();
                    reader.Root = "d.Data";
                    reader.TotalProperty = "d.TotalRecords";
                    reader.Fields.Add(ddl.ValueField);
                    reader.Fields.Add(ddl.DisplayField);
                    x.Reader.Add(reader);
                    ddl.Store.Add(x);
                    ddl.AnchorHorizontal = "95%";
                    AddParameter(param.Label, ddl, param);
                }
    
    
    
                /// <summary>
                /// Add Parameter to current controls collection
                /// </summary>
                /// <param name="title">Parameter Title</param>
                /// <param name="control">Prameter control</param>
                /// <param name="param">Prameter</param>
                private void AddParameter(string title, Ext.Net.Component control, ReportParam param)
                {
                    control.ID = param.Name;
    
                    AddParameter(title, control, param.IsRequired);
                }
    
                /// <summary>
                /// Add Parameter to current controls collection
                /// </summary>
                /// <param name="title">Parameter Title</param>
                /// <param name="control">Prameter control</param>
                /// <param name="isRequired">if true a required field validator will be created for the control</param>
                private void AddParameter(string title, Ext.Net.Component control, bool isRequired)
                {
                    control.FieldLabel = title;
                    if (isRequired)
                    {
                        ((Ext.Net.TextFieldBase)control).AllowBlank = false;
                        ((Ext.Net.TextFieldBase)control).BlankText = String.Format("{0} is required", title);
                    }
                    //this.Items.Add(control);
                    control.Render(this.pnlParameters, Ext.Net.RenderMode.AddTo);
                    this.pnlParameters.Items.Add(control);
                }
    
    
                #endregion
    
                public void SetSelectedReport(string reportClassName)
                {
                    this.ddlReportsList.SetValueAndFireSelect(reportClassName);
                }
                public void ResetSelection()
                {
                    this.ddlReportsList.SelectedIndex = 0;
                    this.pnlParameters.Items.Clear();
                }
            }
    
            public class ReportParam
            {
                #region  Public Properties
    
                private bool isRequired = true;
                /// <summary>
                /// Gets or sets parameter name
                /// </summary>
                /// <remarks>Parameter name should be exact match to stored procedure parameter when using Stored procedure as report data source, or Exact column name if a DataTable or View is used as the report data source.</remarks>
                /// <value>Empty</value>
                public string Name { get; set; }
    
                /// <summary>
                /// Gets or sets parameter Label that displayed to user
                /// </summary>
                /// <value>Empty</value>
                public string Label { get; set; }
    
                /// <summary>
                /// Gets or sets is the parameter required or not
                /// </summary>
                public bool IsRequired
                {
                    get
                    {
                        return isRequired;
                    }
                    set { isRequired = value; }
                }
                public string DisplayField { get; set; }
                public string ValueField { get; set; }
                public string DBTableName { get; set; }
    
    
                #endregion
            }
    
            
            protected void Page_Init(object sender, EventArgs e)
            {
                var ts = new TestSelector
                             {
                                 ID = "tstReportSelector",
    
                             };
    
                ts.ReportSelected += ddlReportSelector_Select;
                
                BorderLayout1.West.Items.Add(ts);   
            }
    
            protected void ddlReportSelector_Select(object sender, DirectEventArgs e)
            {
            }
    
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ScriptManager1" runat="server" HideInDesign="true" SourceFormatting="true"
            ScriptMode="Release" GZip="true">
        </ext:ResourceManager>
        <ext:Viewport runat="server" ID="vp">
            <Items>
                <ext:BorderLayout ID="BorderLayout1" runat="server">
                    <West Collapsible="true" CollapseMode="Mini" Split="true" MinWidth="300">                    
                    </West>
                    <Center>
                        <ext:Panel ID="pnlReportView" runat="server" Title="Report Center">
                        </ext:Panel>
                    </Center>
                </ext:BorderLayout>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
  2. #12
    so if you select 3rd report, are you getting the second combo rendered with mode=remote! because that's not happening with me!!! and still i don't wanna update SVN until why it did happened!
  3. #13
    Hi,

    Do you have the issue on my sample too?
    For example, if create new project, add page with my last sample then do you have the issue still?
  4. #14
    yes it's still same damn problem,

    the version I'm using is:

    extjs/adapter/ext/ext-base-js/ext.axd?v=24608

    i'm guessing that v is for version, i think you have archive for all versions?? so try to use that ext.net version. and test otherwise i stuck with ideas!!
  5. #15
    Hi,

    Please create test project with one sample page (my last sample), inlcude your assemblies and send to me (support@object.net)
    Last edited by geoffrey.mcgill; May 17, 2011 at 7:21 PM.
  6. #16
    Hi,

    Also, you can try to set the following listeners to the combo
    combo.Listeners.AfterRender.Handler = "this.mode='remote';";
  7. #17
    email sent, please check ASAP!
  8. #18
    Hi,

    Yes, I was able to reproduce the issue with your assemblies
    I see that you use Ext.Net assembly which was compiled at 11 March 2011

    The bug "Dynamic combo always rendered with Mode="Local"" was introduced at 2 March 2011 (rev 3487) and was fixed at 16 March (rev 3507). So, you updated at that date interval

    To fix the issue update from SVN or add the listener to combo which i mentioned in previous post
    ddl.Listeners.AfterRender.Handler = "this.mode = 'remote'; ";
  9. #19
    OMG, so its all about update svn! i guess my mind out of sync! thanks dude for clarifying that. mark as solved!
    but why did added
    protected void Page_Init(object sender, EventArgs e)
            {
                var ts = new TestSelector
                             {
                                 ID = "tstReportSelector",
     
                             };
     
                ts.ReportSelected += ddlReportSelector_Select;
                 
                BorderLayout1.West.Items.Add(ts);   
            }
    also can you produce better code to perform the same! or at least give me head-lines on proper design for the controls with events sequence!

    thanks,
  10. #20
    Hi,

    Just I want to create one file sample. It is impossible to add a control to markup if the control is defined in the same page class
    Therefore I used codebehind
Page 2 of 2 FirstFirst 12

Similar Threads

  1. [CLOSED] Item disable style stopped working
    By supera in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 24, 2012, 6:51 AM
  2. Replies: 12
    Last Post: Jul 25, 2011, 2:25 PM
  3. Ext.Net.ResourceBuilder stopped working
    By purvi in forum 1.x Help
    Replies: 0
    Last Post: Sep 22, 2010, 9:52 PM
  4. [CLOSED] VBoxlayout Stopped Working after SVN update
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Mar 23, 2010, 3:17 PM
  5. EventMasks stopped working
    By EzaBlade in forum 1.x Help
    Replies: 5
    Last Post: Mar 24, 2009, 6:21 PM

Tags for this Thread

Posting Permissions