[CLOSED] Namespace Does not register

Page 1 of 3 123 LastLast
  1. #1

    [CLOSED] Namespace Does not register

    Hi,
    I have an issue with a code. I have a Window in a usercontrol which contains a Grid Panel. However, I am getting a JS error which is related to gridpanel rendering before namespace is registered. Can you look at the following code?
    
    <%@ Control Language="C#" AutoEventWireup="true" %><ext:Window Title="Files" Icon="FolderExplore" Namespace="Forms.Files" ID="me" ItemID="me" ButtonAlign="Center" Width="500" Resizable="false" Height="400" runat="server" Padding="5" Layout="FitLayout"    Hidden="false">    <Items>        <ext:GridPanel runat="server" Border="false" ClicksToEdit="2" ID="filesGrid" ItemID="filesGrid">            <Store>                <ext:Store runat="server" ID="filesGridStore" ItemID="filesGridStore">                    <Reader>                        <ext:JsonReader IDProperty="filename">                            <Fields>                                <ext:RecordField Name="filename" ServerMapping="filename">                                </ext:RecordField>                                <ext:RecordField Name="lastaccess" ServerMapping="lastaccess">                                </ext:RecordField>                                <ext:RecordField Name="createdon" ServerMapping="createdon">                                </ext:RecordField>                            </Fields>                        </ext:JsonReader>                    </Reader>                </ext:Store>            </Store>            <ColumnModel>                <Columns>                    <ext:Column Header="File Name" Editable="true" DataIndex="filename">                    </ext:Column>                    <ext:Column Header="Last accessed" Editable="false" DataIndex="lastaccess">                    </ext:Column>                    <ext:Column Header="Created On" DataIndex="createdon">                    </ext:Column>                    <ext:CommandColumn>                        <Commands>                            <ext:GridCommand Text="Open" Icon="FolderGo">                            </ext:GridCommand>                            <ext:CommandSeparator />                            <ext:GridCommand Text="Delete" Icon="FolderDelete">                            </ext:GridCommand>                        </Commands>                    </ext:CommandColumn>                </Columns>            </ColumnModel>            <Buttons>                <ext:Button runat="server" Text="Create new file" Icon="FolderAdd">                </ext:Button>                <ext:Button runat="server" ID="btnUpload" Text="Upload" Icon="FolderUp">                </ext:Button>                <ext:Button runat="server" Icon="Cancel" Width="80" ID="btnCancel" Text="Close" ItemID="btnCancel">                </ext:Button>            </Buttons>        </ext:GridPanel>    </Items></ext:Window>
    Here's the code for the page where I am trying to use this control.
    
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="GradeWeb.test" %><%@ Register TagPrefix="Form" TagName="Files" Src="~/Forms/Files.ascx" %><!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>     </head><body>    <form id="form1" runat="server">                   <ext:ResourceManager ID="ResourceManager1" runat="server"  />                              <Form:Files ID="Files1" runat="server" Visible="true"></Form:Files>                    </form></body>
    Having the code for window directly on page also gives the same issue. However, when I remove the namespace, it works on the page. But even if I remove the namespace it does not work in User Control. Can you please check it?
    Last edited by Daniil; Nov 07, 2011 at 10:17 AM. Reason: [CLOSED]
  2. #2
    By adding the following code just before window solves the issue. But then this is a workaround.

    <ext:Container runat="server" ID="dummy" Namespace="Forms.Files" ItemID="dummy" Hidden="true"></ext:Container>
    Last edited by geoffrey.mcgill; Nov 04, 2011 at 4:39 PM.
  3. #3
    I this problem fixed, or do you require further assistance?

    Can you format your code samples in the first post, as they appear to be condensed into a single line.
    Geoffrey McGill
    Founder
  4. #4
    Please try the code. There is a obvious problem. I have a workaround, but still I think it shud be resolved. Just register the following user control on a page and u will see there is a problem. Here's the formatted code.

    
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Files.ascx.cs" Inherits="GradeWeb.Forms.Files" %><ext:Window Title="Files" Icon="FolderExplore" Namespace="Forms.Files" ID="me" ItemID="me" ButtonAlign="Center" Width="500" Resizable="false" Height="400" runat="server" Padding="5" Layout="FitLayout"    Hidden="false"><Items><ext:GridPanel runat="server" Border="false" ClicksToEdit="2" ID="filesGrid" ItemID="filesGrid" Namespace="Forms.Files"><Store><ext:Store runat="server" ID="filesGridStore" ItemID="filesGridStore" Namespace="Forms.Files"><Reader><ext:JsonReader IDProperty="filename"><Fields><ext:RecordField Name="filename" ServerMapping="filename"></ext:RecordField><ext:RecordField Name="lastaccess" ServerMapping="lastaccess"></ext:RecordField><ext:RecordField Name="createdon" ServerMapping="createdon"></ext:RecordField></Fields></ext:JsonReader></Reader></ext:Store></Store><ColumnModel><Columns><ext:Column Header="File Name" Editable="true" DataIndex="filename"></ext:Column><ext:Column Header="Last accessed" Editable="false" DataIndex="lastaccess"></ext:Column><ext:Column Header="Created On" DataIndex="createdon"></ext:Column><ext:CommandColumn><Commands><ext:GridCommand Text="Open" Icon="FolderGo"></ext:GridCommand><ext:CommandSeparator /><ext:GridCommand Text="Delete" Icon="FolderDelete"></ext:GridCommand></Commands></ext:CommandColumn></Columns></ColumnModel><Buttons><ext:Button runat="server" Text="Create new file" Icon="FolderAdd"></ext:Button><ext:Button runat="server" ID="btnUpload" Text="Upload" Icon="FolderUp"></ext:Button><ext:Button runat="server" Icon="Cancel" Width="80" ID="btnCancel" Text="Close" ItemID="btnCancel"></ext:Button></Buttons></ext:GridPanel></Items></ext:Window>
  5. #5
    Sorry geoff,
    But despite formatting and separating each line it still shows up condensed...
  6. #6
    Quote Originally Posted by amitpareek View Post
    Sorry geoff,
    But despite formatting and separating each line it still shows up condensed...
    What browser and version are you using when you paste the code sample? And, are you copying directly from Visual Studio, then pasting into the WYSIWYG editor?

    Maybe try a quick copy/paste into Notepad, then copy/paste from Notepad into the WYSIWYG editor.
    Geoffrey McGill
    Founder
  7. #7
    <ext:Window Title="My GRADEPro Files Explorer" Icon="FolderExplore" Namespace="Forms.Files" ID="me" ItemID="me" ButtonAlign="Center" Width="500" Resizable="false" Height="400" runat="server" Padding="5" Layout="FitLayout"
        Hidden="true" AnimateTarget="top.btnMyGrade">
        <Items>
            <ext:GridPanel runat="server" Border="false" ClicksToEdit="2" ID="filesGrid" ItemID="filesGrid" >
                <Store>
                    <ext:Store runat="server" ID="filesGridStore" ItemID="filesGridStore">
                        <Reader>
                            <ext:JsonReader IDProperty="filename">
                                <Fields>
                                    <ext:RecordField Name="filename" ServerMapping="filename">
                                    </ext:RecordField>
                                    <ext:RecordField Name="lastaccess" ServerMapping="lastaccess" Type="Date" DateFormat="m/d/Y h:i:s A">
                                    </ext:RecordField>
                                    <ext:RecordField Name="createdon" ServerMapping="createdon" Type="Date" DateFormat="m/d/Y h:i:s A">
                                    </ext:RecordField>
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel>
                    <Columns>
                        <ext:Column Header="File Name" Editable="true" DataIndex="filename">
                        </ext:Column>
                        <ext:Column Header="Last accessed" Editable="false" DataIndex="lastaccess">
                           
                        </ext:Column>
                        <ext:Column Header="Created On" DataIndex="createdon">
                        </ext:Column>
                        <ext:CommandColumn Width="120">
                            <Commands>
                                <ext:GridCommand Text="Open" Icon="FolderGo">
                                </ext:GridCommand>
                                <ext:CommandSeparator />
                                <ext:GridCommand Text="Delete" Icon="FolderDelete">
                                </ext:GridCommand>
                            </Commands>
                        </ext:CommandColumn>
                    </Columns>
                </ColumnModel>
                <Buttons>
                    <ext:Button runat="server" Text="Create new file" Icon="FolderAdd">
                    </ext:Button>
                    <ext:Button runat="server" ID="btnUpload" Text="Upload" Icon="FolderUp">
                    </ext:Button>
                    <ext:Button runat="server" Icon="Cancel" Width="80" ID="btnCancel" Text="Close" ItemID="btnCancel">
                    </ext:Button>
                </Buttons>
            </ext:GridPanel>
        </Items>
    </ext:Window>
  8. #8
    Hi,

    Seem to work fine. Below is my test case.

    Example Page
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Control c = this.LoadControl("TestUC.ascx");
            c.ID = "TestUC";
            this.Form.Controls.Add(c);
        }
    </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 Example</title>
    
        <script type="text/javascript">
            var Test = {};
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Button runat="server" Text="Click me">
                <Listeners>
                    <Click Handler="alert(Test.Test.TestUC_Window1)" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    Example User Control
    <%@ Control Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <ext:Window ID="Window1" runat="server" Namespace="Test.Test" />
    How do you try to access a Window? This way:
    Forms.Files.me
    Please note that a ClientID doesn't equal an ID by default, because a user control implements INamingContainer.

    If you need a ClienID to be equal an ID, please set up IDMode="Explicit" for an <ext:Window>.
  9. #9
    Hi Daniil,
    Please use my user control code. And register it in markup. You will see the error in js console when u load the page.
  10. #10
    My whole application is structured this way. And it works perfectly. The only problem is when I use a Grid Panel in window/panel in a usercontrol.
Page 1 of 3 123 LastLast

Similar Threads

  1. [CLOSED] Register UserControl with Loader
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 16, 2012, 1:42 PM
  2. [CLOSED] register xtype
    By RomualdAwessou in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Nov 03, 2010, 6:49 PM
  3. Replies: 8
    Last Post: May 25, 2010, 6:24 AM
  4. combobox not show the first register of Store
    By DarkDucke in forum 1.x Help
    Replies: 0
    Last Post: Mar 04, 2009, 2:23 PM
  5. [CLOSED] Register icons dynamically
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Dec 10, 2008, 11:36 AM

Posting Permissions