[CLOSED] Removing and Re-adding ResourceManager

  1. #1

    [CLOSED] Removing and Re-adding ResourceManager

    I'm creating a nice exception handling page. Since I don't know what has already been put on the page, I'd like to clear all the controls and rebuild the whole page.

    The problem is that if I try to remove the ResourceManager, and re-add it it fails saying 'only one resource manger per page'.

    Is there an easy solution to this?



        protected void Page_Init(object sender, EventArgs e)
        {
          Form.Controls.Add(new Ext.Net.ResourceManager());
          Form.Controls.Add(new Ext.Net.Panel{Html="Normal Page"} );
        }
        protected void Page_Load(object sender, EventArgs e)
        {
          try
          {
            throw new Exception("Bad");
          }
          catch(Exception)
          {
            Form.Controls.Clear();   // Removes all controls, Resouce Manager is no longer on page
            Form.Controls.Add(new Ext.Net.ResourceManager()); // Fails
            Form.Controls.Add(new Ext.Net.Panel{Html="Nice Error Page"} );
          }
        }
  2. #2

    RE: [CLOSED] Removing and Re-adding ResourceManager

    Hi,

    It is strange decision to remove all controls and build new UI for error notification (generally, in most applications call Server.Transfer("Error.aspx"))

    In any way, we have added Unregister method to the ResourceManager (please update from SVN)
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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 id="Head1" runat="server">
        <title></title>
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                this.ResourceManager1.Unregister();
                this.Form.Controls.Clear();
                this.Form.Controls.Add(new Ext.Net.ResourceManager());
            }
        </script>
    
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />        
            
        </form>
    </body>
    </html>
    P.S. By the way, ASP.NET ScriptManager raises the same exception :)

Similar Threads

  1. [CLOSED] removing cells from rowlayout
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Jun 17, 2011, 11:46 AM
  2. Replies: 9
    Last Post: Nov 04, 2010, 8:26 PM
  3. Replies: 2
    Last Post: May 02, 2010, 4:33 PM
  4. [CLOSED] [1.0] Adding a CustomListener in the ResourceManager
    By bsnezw in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 01, 2010, 3:10 AM
  5. [CLOSED] Grid adding removing columns in codebehind
    By methode in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Feb 24, 2009, 2:51 AM

Posting Permissions