[CLOSED] [1.0] Javascript error when loading usercontrol from code

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] [1.0] Javascript error when loading usercontrol from code

    I get an Javascript error when loading a usercontrol with Fitlayout .

    If Fitlayout is missing everything is ok.

    Static loading from ascx file is also ok.

    I made a small example.
    Last edited by geoffrey.mcgill; Jul 07, 2010 at 2:25 AM.
  2. #2

    RE: [1.0] Javascript error when loading usercontrol from code

    Hi,

    UpdateContent should be used during AjaxRequest only. Therefore wrap your LoadUserControl calling by IsAjaxRequest
     If (Ext.Net.X.IsAjaxRequest) Then
                LoadUserControl(def_pnlwuc01, "wuc01")
            End If
  3. #3

    RE: [1.0] Javascript error when loading usercontrol from code

    Hi,

    By the way, why do you need to update content on each request? Is it really required?
  4. #4

    RE: [1.0] Javascript error when loading usercontrol from code

    Thanks Vladimir

    I don't need to update the content on each request.
    The sample application only has to show the error.

    I will try to load the usercontrol in an ajaxrequest.

  5. #5
    The problem still exists also in an Ajaxrequest.
    If you delete the Fitlayout (and <Items>) from usercontrol the usercontrol can be loaded otherwise a javascript-error occurs.

    How can I use Fitlayout in an usercontrol?

    I made another small example.

    Klaus
  6. #6
    Hi,

    UpdateContent must be used if content without layout. If you wrap user control body by layout then you have to use Render method of the Container (def_pnlwuc01 panel in your case)

    def_pnlwuc01 is center region, center region cannot be rerendered because it cannot be removed from layout(Render method destroys previous instance)

    Solution:

    1. Wrap def_pnlwuc01 panel by Container with Layout="Fit"
    <ext:Container runat="server" Layout="Fit">
              <Items>
                    <ext:Panel ID="def_pnlwuc01" runat="server" Layout="Fit" Title="UserControl" Icon="ApplicationViewDetail">
    2. Use Render method instead UpdateContent
    def_pnlwuc01.Render()
  7. #7
    Hi Vladimr,

    the code work fine in my sample application but in my real application i get now another javascript error.
    If you add a store and a combobox to the usercontrol ascx file you get another javascript error (ucde01_RefCategory is undefined).
    What can I do?

    <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="wuc_deteg001.ascx.vb" Inherits="uc_event.wuc_deteg001" %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <ext:Store ID="ucde01_RefCategory" runat="server" RemoteSort="true">
        <Reader>
            <ext:JsonReader  IDProperty="RcaId">
                <Fields>
                    <ext:RecordField Name="RcaId" />
                    <ext:RecordField Name="RcaName" />
                    <ext:RecordField Name="RcaShortname" />
                    <ext:RecordField Name="RcaForeignKey" />
                    <ext:RecordField Name="RcaSort" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    
    
      <ext:FitLayout ID="ucde01_FitLayout1" runat="server">
        <Items>
          <ext:Panel ID="ucde01_View01" runat="server" Border="false" Layout="Absolute" AutoScroll="true" TitleCollapse="true" Height="600">
                <Items>
                    <ext:TextField ID="ucde01_Txt_CusId" runat="server" X="0" Y="0" Width="20"  Hidden="true"/>
                    <ext:Label ID="ucde01_Lbl_CusNo" runat="server" X="4" Y="12" Text="Kundennummer" />
                    <ext:TextField ID="ucde01_Txt_CusNo" runat="server" X="140" Y="8" Width="240" MaxLength="20" ReadOnly="true"/>
                    <ext:Label ID="ucde01_Lbl_CusNo5" runat="server" X="4" Y="40" Text="Kundennummer alt" />
                    <ext:TextField ID="ucde01_Txt_CusNo5" runat="server" X="140" Y="36" Width="240" MaxLength="10" ReadOnly="true"/>
                    <ext:Label ID="ucde01_Lbl_CadName1" runat="server" X="4" Y="68" Text="(Firmen)name" />
                    <ext:TextField ID="ucde01_Txt_CadName1" runat="server" X="140" Y="64" Width="240" MaxLength="50" />
                     <ext:ComboBox ID="ucde01_Cmb_CusRcaId" runat="server" StoreID="ucde01_RefCategory" Width="240" TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All" EmptyText="Wähle Kategorie..." SelectOnFocus="true" X="544" Y="484" ValueField="RcaId"  DisplayField="RcaName" > </ext:ComboBox>    
    
               </Items>
            </ext:Panel>
       </Items>
    </ext:FitLayout>
    Last edited by geoffrey.mcgill; Jul 15, 2010 at 6:33 AM.
  8. #8
    I found the solution for the problem with the store.
    The store must be put into the page aspx-file.
    Thanks for your help.
    Klaus

Similar Threads

  1. [CLOSED] Loading UserControl window from Parent Form throwing error
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 10, 2011, 3:43 PM
  2. Replies: 2
    Last Post: Jan 14, 2011, 5:51 PM
  3. [CLOSED] Error: 'dom.style' by loading UserControl
    By smart+ in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 30, 2010, 6:24 PM
  4. [CLOSED] Javascript error when using this usercontrol
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 25
    Last Post: Jun 15, 2010, 5:26 PM
  5. [CLOSED] Javascript Error loading dynamic usercontrol 1.0
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 01, 2010, 3:05 AM

Posting Permissions