Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 396077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:30:59+00:00 2026-05-12T16:30:59+00:00

When a menu item is clicked in my menu an ASCX control is loaded

  • 0

When a menu item is clicked in my menu an ASCX control is loaded via AJAX in my asp panel. To do this I have a method:

public void LoadControl(ControlDestination controlDestination, string filename)
{
    try
    {
        // Load control from file
        Control control = LoadControl(filename);

        // Check control extends BaseForm
          // Do stuff    
        }
        else
        {
            throw new Exception("Web User Control erft niet van BaseForm.");
        }
    }
    catch (ArgumentNullException e)
    {
        // Implement
    }
    catch(HttpException e)
    {
        LoadControl(ControlDestination.Menu, "Error.ascx");
        throw new Exception("User control niet gevonden: " + e.ToString());
    }
}

When I set a breakpoint at the HttpException I get there. I press F11 and the code in LoadControl is executed. Then the excetpion pops up. All this goes well, but Error.ascx is never loaded. I know the method is working because when I want to load other ASCX objects via this method it works. But When I want to load Error.ascx is goes wrong.

I can see Error.ascx if I comment out throw new Exception(“User control niet gevonden” + e.ToString()); I want both lines to be executed.

EDIT:

In my master page I have this javascript code to catch some exceptions:

function pageLoad() {
    var manager = Sys.WebForms.PageRequestManager.getInstance();
    manager.add_endRequest(endRequest);
    manager.add_beginRequest(beginRequest);
}

function endRequest(sender, args){
    var Error = args.get_error();
    if (Error != null) {
        ToggleErrorOn(true);
        document.getElementById("ErrorContent").innerHTML = Error.message;
        args.set_errorHandled(true);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T16:30:59+00:00Added an answer on May 12, 2026 at 4:30 pm

    When you trigger a server-side method in an UpdatePanel ASP.NET does the following:

    1. Rebuilds the portion of the page
      within the panel from scratch by
      running through the normal ASP.NET
      page lifecycle (well, slightly
      abridged, but close).
    2. Sends the panel’s HTML back
      to the client.
    3. Rebuilds the panel on the
      client using javascript DOM
      manipulation.

    If there’s an unhandled Exception during the first step, the AJAX call fails and it cannot update the originating panel. Here’s a diagram from the ASP.NET AJAX web site:

    Partial-Page Rendering Overview

    Consider what would happen if you threw an unhandled Exception in Page_Load. ASP.NET wouldn’t be able to finish constructing your HTML in that case, and it cannot do so here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp:Menu and it contains a top level menu item that points
I am using notification to get control when menu items clicked... - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
I have a taskbar menu that when clicked is connected to a slot that
I have the following code: $(li.item).live('click',function() { $('#menu').animate({ }, 500); }); Now, I would
I can create a menu item in the Windows Explorer context menu by adding
When the New menu item on a Document Library expands the default seems to
How do I implement a Copy menu item in a Windows application written in
I'd like to add a menu item to the default ContextMenu of a RichTextBox
I don't want a close window menu item in the task bar context menu
How can I hide a menu item under certain conditions in MFC? I'm not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.