[1.0] JavaScript error on load user control

  1. #1

    [1.0] JavaScript error on load user control

    I am trying to load a user control with dynamic select boxes at runtime.
    I get following message: "Microsoft JScript compilation error: Expected ':' "

    Here is my scenario

    main page

    <ext:Panel ID="Panel1" runat="server">
                    <table width="100%" height="100%">
                                <ext:SelectBox AutoDataBind="true" ID="TechDescrSB" runat="server" StoreID="TechDescrStore"
                                    ValueField="DescrId" DisplayField="Descr" FieldLabel="Тех. характеристика (модель)"
                                    <Select OnEvent="CreateCtrl">
                                                <ext:Parameter Name="DescrId" Value="#{TechDescrSB}.getValue()" Mode="Raw" />
                            <ext:Container ID="Container1" runat="server" Region="Center" Layout="Fit"> 
                                    <ext:Panel runat="server" ID="DynPan1" Height="25"></ext:Panel>
    Codebehind main page

    protected void CreateCtrl(object sender, DirectEventArgs e)
                var control = LoadControl("UserControls/CreateATDControls.ascx");
    User Control

    <ext:Panel runat="server" ID="DynPan" AutoHeight="true">
    <ext:Store ID="UCStore" runat="server" >         
            <ext:JsonReader root="data">
                    <ext:RecordField Name="AdvTechDescrSprId" Type="Int" />
                    <ext:RecordField Name="DescrId" Type="Int" />
                    <ext:RecordField Name="AdvTechDescrNameSprId" Type="Int" />
                    <ext:RecordField Name="Value" Type="String" />
                    <ext:RecordField Name="IsDefault" Type="Boolean" />
    CodeBehind UserControl

     public int DescrId
                get { return Request.QueryString["DescrId"] != null ? Convert.ToInt32(Request.QueryString["DescrId"]) : 27; }
            protected void Page_Load(object sender, EventArgs e)
                int i = 0;
                List<TAdvTechDescrNameSpr> l = new AdvTechDescrSprManager().GetUnqAdvTechDescrNameListByDescrID(DescrId);
                foreach (TAdvTechDescrNameSpr obj in l)
                    i += 1;
                    string showName = obj.Name;
                    List<TAdvTechDescrSpr> atdList = new AdvTechDescrSprManager().GetAdvTechDescrList(DescrId, obj.AdvTechDescrNameSprId);               
                        UCStore.DataSource = atdList;
                        UCStore.SetDataFromJson(String.Format("{{totalCount:{1},'data' : {0}}}", JSON.Serialize(atdList), atdList.Count));
                        SelectBox sb = new SelectBox();
                        sb.StoreID = "UCStore";
                        sb.DisplayField = "Value";
                        sb.ValueField = "AdvTechDescrSprId";
                        sb.FieldLabel = showName;
                        sb.Width = Unit.Pixel(250);
                        sb.SelectedIndex = 0;
    Printscreen with message attached
    Attached Thumbnails Click image for larger version. 

Name:	err.jpg 
Views:	104 
Size:	103.9 KB 
ID:	1632  
  2. #2

    Please remove
  3. #3
    After changes (remove render) I get the following message "ctl1`2_UCStore is undefined". What is wrong?
    Attached Thumbnails Click image for larger version. 

Name:	err.jpg 
Views:	115 
Size:	94.0 KB 
ID:	1633  
  4. #4

    Content is always rendered after Items. Therefore move the store outside the panel (before DynPan)
  5. #5
    It's work now! Thank you :cool:

Similar Threads

  1. Replies: 2
    Last Post: Feb 06, 2012, 9:06 AM
  2. [CLOSED] JavaScript error in dynamic user control
    By schellappa in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Dec 21, 2010, 4:01 PM
  3. how to load user control ondemand.
    By Satyanarayana murthy in forum 1.x Help
    Replies: 2
    Last Post: Jun 17, 2010, 7:40 AM
  4. [CLOSED] Programmatically load User Control from AJAXMethod
    By SamFoot in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 28, 2009, 4:47 AM
  5. Load user control on DesktopWindow open
    By Mohammad Yakub in forum 1.x Help
    Replies: 0
    Last Post: Jan 29, 2009, 8:49 AM

Posting Permissions