[CLOSED] ext.UserControlLoader in CodeBehind

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] ext.UserControlLoader in CodeBehind

    Hi

    I try add my own usercontrol in a tabPanel. I´m fail!

    I use a UserControlLoader... in my usercontrol, I´m use only ext.net components.

    The code to Load my own usercontrol in TabPanel follows:

    Occurs two problems:
    1 - Add only one tab in tabPanel... I try add many tabs.
    2 - The content of usercontrolLoader, (my own Usercontrol) is not show.
    3 -

    I believe that the problem is the usercontrolloader.addto. Is this a correct mode of add controls in UserControlLoader?
    Is there any example for me to follow?

            Dim tabPanelConfig As Ext.Net.Panel.Config = New Ext.Net.Panel.Config
            Dim tabContext As ExplorerWebContext = New ExplorerWebContext
            Dim tabPanel As Ext.Net.Panel
            Dim ucLoader As Ext.Net.UserControlLoader = New Ext.Net.UserControlLoader
    
            tabContext.Start(Context)
    
            With tabPanelConfig
                .Title = tabContext.ContextoDescription
                .Closable = True
                .Border = True
                .Padding = 6
            End With
    
            tabPanel = New Ext.Net.Panel(tabPanelConfig)
            ucLoader.AddTo(tabContext)
            tabPanel.Items.Add(ucLoader)
            tabWebExplorer.Items.Add(tabPanel)
            tabWebExplorer.Render()
    Last edited by Daniil; Feb 07, 2012 at 5:43 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please clarify the requirement.

    Do you need to add tabs during Page_Load or DirectEvent?

    What is the content of tabs - a user control?
  3. #3
    Hi Daniil...

    I am sorry if I was not clear in my request!

    Do you need to add tabs during Page_Load or DirectEvent?
    I need add tabs in DirectEvent

    What is the content of tabs - a user control?
    Yes, I add in tab my own usercontrol.
  4. #4
    Please look at the example.

    Example Page
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void AddTab(object sender, DirectEventArgs e)
        {
            UserControlLoader ucl = new UserControlLoader();
            ucl.Path = "TestUC.ascx";
    
            Ext.Net.Panel p = new Ext.Net.Panel("Tab");
    
            p.Items.Add(ucl);
    
            this.TabPanel1.Items.Add(p);
    
            p.Render();
        }
    </script>
    
    <!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 v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:TabPanel ID="TabPanel1" runat="server" />
            <ext:Button runat="server" Text="Add tab" OnDirectClick="AddTab" />
        </form>
    </body>
    </html>
    Example User Control
    <%@ Control Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <ext:Panel runat="server" Html="Hello from User Control. I am 1" />
    
    <ext:Panel runat="server" Html="Hello from User Control. I am 2" />
  5. #5
    Hi Daniil,

    Thanks for your example...

    Its is very similar to what I´m doing... But I get different errors in my project...

    I have a error in YOUR example... Let´s start with this.
    1 - In YOUR example, set the Closable property of tab for True, please.
    2 - Run test page.
    3 - Add 4 tabs.
    4 - Close first or last tab... you will get the following error.

    Runtime Error in Microsoft JScript: Type mismatch.
    Attachment 3805
  6. #6
    I was unable to reproduce the error following the steps you provided.

    Any more changes?

    What browser do you test with?
  7. #7
    Hi Daniil...

    You're right about seem to be a browser issue.

    After your comment, I ran the test in FireFox 9.0.1, Opera 11.61, Google Chrome 16.0.912.77, and the error did not occur in any of these browsers.

    In Internet Explorer version 9.0.8112.16421, update version 9.0.4 (kb2618444), the error occurs.[

    Attachment 3806
  8. #8
    I've tested with the same IE9, but still can't reproduce the problem.

    I'm testing under Windows 7 Home Premium.

    What OS do you test with?
  9. #9
    Windows 7 Professional with Service Pack 1 64 Bits.
    Processor Intel Core i3-2100 CPU 3.10 GHZ
    Ram 4 GB

    Would you try to access my computer via logmein, teamviewer, vnc or other?
    If you want to try, please add me on windows live messenger gefferson@superainfo.com.br.
  10. #10
    Quote Originally Posted by supera View Post
    Windows 7 Professional with Service Pack 1 64 Bits.
    Processor Intel Core i3-2100 CPU 3.10 GHZ
    Ram 4 GB
    I have the SP1 and 64 bits as well. The single difference is "Proffessional" and "Home Premium". Well, I don't think it might be a reason of the problem, but not 100% sure.

    Also I don't think the PC processor and RAM might cause the problem.

    Could you double ensure were there no more changes in my example on your side apart from Closable="true"? Did you port it on VB?

    Quote Originally Posted by supera View Post
    Would you try to access my computer via logmein, teamviewer, vnc or other?
    If you want to try, please add me on windows live messenger gefferson@superainfo.com.br.
    I think it's not required on this stage, but I will keep it in mind.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] UserControlLoader and Content
    By thchuong in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 11, 2012, 8:03 AM
  2. [CLOSED] HTMLEditor Get Value in codebehind
    By VALUELAB in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Jul 28, 2011, 1:47 AM
  3. [CLOSED] Add RowSelectEvent via codebehind
    By 78fede78 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 16, 2010, 11:53 AM
  4. [CLOSED] Equivalent of Ext.ID via C# Codebehind
    By Steve in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 03, 2009, 3:53 PM
  5. [CLOSED] Add panel from codebehind
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 17, 2008, 8:45 AM

Posting Permissions