After pressing "submit" button, I need to have success message shown. I'm trying to do it with this line :
ScriptManager.RegisterStartupScript(this, this.GetType(), "temp", "Success", false);
The error is :
Error CS1503 Argument 1: cannot convert from 'WebApplication2.Controllers.AccountController' to 'System.Web.UI.Page'
I've tried looking similar topics, changing 'this' to 'Page' and so on - no luck. Any help would be appreciated.
Problem was solved using
TempData["AlertMessage"] = "Registration was successful";
in controller
and
@{
var message = TempData["AlertMessage"] ?? string.Empty;
}
<script type="text/javascript">
var message = '@message';
if(message)
alert(message);
</script>
in views.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.