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 8179669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:03:12+00:00 2026-06-07T00:03:12+00:00

I have a PartialView called TopPanel. This Panel is responsible for displaying error messages

  • 0

I have a PartialView called TopPanel. This Panel is responsible for displaying error messages generated on any page in my application. To handle this, when any exception occurs on a page, I have it call an “ErrorHandler” action in the TopPanel controller. ErrorHandler updates the ViewBag with the error message and calls the Index action which just returns the partial view(for now, since im testing. I will have it call the Main Controllers Index Action later to display the whole page). My understanding is that calling the Index action will reload the view and the ErrorDiv that I have on TopPanels PartilaView will be able to display the new error message in ViewBag. However, nothing gets displayed and I’m not sure why.

Heres some code –

The ErrorHandler Action –

public ActionResult ErrorHandler(string message)
{
        ViewBag.ErrorMsg = message;
        return RedirectToAction("Index");
}

I’ve checked in the debugger, “message” does have a valid value. And ViewBag.ErrorMsg does get populated as well.

Index Action of TopPanel –

 public ActionResult Index()
 {           
        return PartialView();
 }

TopPanels PartialView contains this lone which displays the error –

<div id="errorMsgBox">@ViewBag.ErrorMsg</div>

Can anyone point out what the issue is?

  • 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-06-07T00:03:13+00:00Added an answer on June 7, 2026 at 12:03 am

    RedirectToAction is like a browser redirect. It actually sends the redirect code to the browser and the action name is the new URL to request. As such you’re actually sending a new request to the server for a new page, which will have its own ViewBag.

    Instead of RedirectToAction you might just want to return the View and specify the PartialView name.

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

Sidebar

Related Questions

i have a master page called layout.cshtml and a page called testpage.cshtml. On this
I have a partial view called StudentInfo.ascx. In it I have something like this:
I have been looking at this error for quite some time, and can't seem
I have a viewpage and a partialview on that. For default request-when page is
I have Action which return partial view. This partial view is called from different
I have a partial view that I have created called noteEditor. That is rendered
Hi guys i have controller which returns a partial view, the controller is called
I have a PartialView which I need to create a button on, and once
I have called a view from another with Html.Action method. I want to call
I have a controller called Categories and you are allowed to type a few

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.