This is a question of interest in managing JavaScript inside C # code, not a discussion of whether this is a good design.
I started experimenting with creating a warning from inside the controller using this answer . I understand that common practice does not use JS in the controller.
If I create a warning inside the controller, how can I control the flow of the program to then return the view. Upon return, a warning prevents progress from displaying the view.
The first method pauses the code in DoSomething:
public ActionResult DoSomething()
{
if(User.Role == someRole)
{
return Content("<script language='javascript' type='text/javascript'>alert('Merchant on Hold');</script>");
}
}
public ActionResult Dashboard()
{
}
The second method pauses the code in your account.
public ActionResult DoSomething()
{
if(User.Role == someRole)
{
return RedirectToAction("Dashboard", "AppUser", new { message = 1 });
}
}
public ActionResult Dashboard(int? message)
{
if(message == 1)
return Content("<script language='javascript' type='text/javascript'>alert('Merchant on Hold');</script>");
}
, , , .
, , , .
.
, , #.