TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Denmark Puso
NA
232
50k
ViewBag.Message not working?
Aug 10 2019 2:04 AM
im using asp.net mvc my viewbag message not working can someone help me.
else
{
var order = new Order
{
ClientId = model.ClientId,
StateId = model.StateId,
CityId = model.CityId,
TownId = model.TownId,
Postcode = model.Postcode,
Address = model.Address,
DatePosted = DateTime.Now,
DeliveryDate = Convert.ToDateTime(model.DeliveryDate),
Quantity = model.Quantity,
Status = "Lined-up",
DateDelivered = null,
Notes = model.Notes ?? ""
};
_orderService.Add(order);
ViewBag.Message = "Your order successfully inserted";
return RedirectToAction("add");
}
My script
@if (ViewBag.Message != null)
{
<script type="text/javascript">
window.onload = function () {
alert("@ViewBag.Message");
};
</script>
}
Reply
Answers (
12
)
What is the meaning of reference types?
Secure Code to prevent Re-sharing