[CLOSED] Dynamic load user controls in Opera

  1. #1

    [CLOSED] Dynamic load user controls in Opera



    Hello, dynamic load user controls with grid panel during ajax request I've got errors in Opera and content inside user control won't render

    Inline script compilation
    Syntax error at line 30 while loading:
    ,j=sorters.length;i1){for(var i=1,j=sort
    --------------------^
    expected ';', got ')'


    Here is sample

    Defaul.aspx

    
    <%@ Language="C#" AutoEventWireup="true" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <%@ Register Src="~/Test.ascx" TagPrefix="test" TagName="foo" %>
    <script runat="server">
        protected void FooClick(object sender, DirectEventArgs e)
        {
            var control =  LoadControl("~/Test.ascx");
            _panelTest.ContentControls.Add(control);
            _panelTest.UpdateContent();
        }
    </script>
    
    
    <html>
    <head>
        <title>
            Example
        </title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <form runat="server" id="formMain">
        <ext:Button runat="server" Text="Foo">
            <DirectEvents>
                <Click OnEvent="FooClick" />
            </DirectEvents>
        </ext:Button>
    
        <ext:Panel Height="400" Width="400" runat="server" ID="_panelTest" Layout="Fit">
        <Content>
            
        </Content>
        </ext:Panel>
        </form>
    </body>
    </html>



    and Test.ascx

    
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Test.ascx.cs" Inherits="UserControlTest.Test" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <ext:GridPanel runat="server" ID="_grid">
        <Store>
            <ext:Store runat="server">
                <Reader>
                    <ext:JsonReader IDProperty="id">
                        <Fields>
                            <ext:RecordField Name="name" />
                            <ext:RecordField Name="id" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        <ColumnModel>
            <Columns>
                <ext:Column Header="name" DataIndex="name" />
            </Columns>
        </ColumnModel>
    </ext:GridPanel>
    Grid panel filled with some stuff on Page load like

    
    string data =
                    @"[{id:0,name:'bla'}]";
                _grid.Store.Primary.SetDataFromJson(data);
                _grid.Store.Primary.DataBind();
    *
  2. #2

    RE: [CLOSED] Dynamic load user controls in Opera

    Hi,

    I cannot reproduce the issue under the Opera. The single issue that you must define ID for the Store
    Here is my test case

    Page.aspx
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <%@ Register Src="TestUserControl.ascx" TagPrefix="test" TagName="foo" %>
    <script runat="server">
        protected void FooClick(object sender, DirectEventArgs e)
        {
            var control = LoadControl("TestUserControl.ascx");
            _panelTest.ContentControls.Add(control);
            _panelTest.UpdateContent();
        }
    </script>
    
    
    <html>
    <head>
        <title>
            Example
        </title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <form runat="server" id="formMain">
        <ext:Button runat="server" Text="Foo">
            <DirectEvents>
                <Click OnEvent="FooClick" />
            </DirectEvents>
        </ext:Button>
    
        <ext:Panel Height="400" Width="400" runat="server" ID="_panelTest" Layout="Fit">
        <Content>
            
        </Content>
        </ext:Panel>
        </form>
    </body>
    </html>
    TestUserControl.ascx
    <%@ Control Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            string data =
                    @"[{id:0,name:'bla'}]";
            _grid.Store.Primary.SetDataFromJson(data);
            _grid.Store.Primary.DataBind();
        }
    </script>
    
    <ext:GridPanel runat="server" ID="_grid">
        <Store>
            <ext:Store ID="Store1" runat="server">
                <Reader>
                    <ext:JsonReader IDProperty="id">
                        <Fields>
                            <ext:RecordField Name="name" />
                            <ext:RecordField Name="id" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        <ColumnModel>
            <Columns>
                <ext:Column Header="name" DataIndex="name" />
            </Columns>
        </ColumnModel>
    </ext:GridPanel>
  3. #3

    RE: [CLOSED] Dynamic load user controls in Opera

    No, yours example also didn't work. I test on Opera 10.53 and sources from SVN updated this morning.
  4. #4

    RE: [CLOSED] Dynamic load user controls in Opera

    Just found interesting thing, problem appears only if scripts in "Release" mode, in Debug works fine. So maybee this is why you can't reproduce error.*
  5. #5

    RE: [CLOSED] Dynamic load user controls in Opera

    Hi,

    I am not sure what happens in the Opera under Release mode
    Please use the following workaround while we are investigating the problem
    - add the following code to the page (or you can call it in the code behind)
    <% ResourceManager.RegisterControlResources<GridPanel>(); %>
  6. #6

    RE: [CLOSED] Dynamic load user controls in Opera

    Hi,

    We have found the source of problem. Please update from SVN and retest
  7. #7

    RE: [CLOSED] Dynamic load user controls in Opera

    Thank you Vladimir, it's work now.*

Similar Threads

  1. How to load dynamic user controls on desktop shortcut?
    By laphuynhkien in forum 2.x Help
    Replies: 4
    Last Post: Aug 23, 2012, 5:58 PM
  2. Replies: 1
    Last Post: Jul 20, 2012, 8:08 AM
  3. [CLOSED] Problem on dynamic load user control
    By andreasperanza in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: Dec 22, 2011, 4:23 PM
  4. [CLOSED] Dynamic loading of user controls [1.0]
    By SFritsche in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Feb 11, 2010, 6:08 AM
  5. How to dynamically load user controls?
    By zikr in forum 1.x Help
    Replies: 0
    Last Post: Jan 23, 2009, 9:35 PM

Posting Permissions