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)
{
window.onload = function () {
alert("@ViewBag.Message");
};
}
Denmark PusoPosted Aug 12, 2019, 9:47 PM
Denmark PusoPosted Aug 12, 2019, 9:12 PM
Tamal MarickPosted Aug 12, 2019, 6:46 AM
Denmark PusoPosted Aug 11, 2019, 8:48 PM
Faisal Pathan
still the same when i click the page they show first.Faisal PathanPosted Aug 10, 2019, 5:37 AM
Denmark PusoPosted Aug 10, 2019, 4:36 AM
Denmark PusoPosted Aug 10, 2019, 4:25 AM
Faisal PathanPosted Aug 10, 2019, 4:08 AM
Denmark PusoPosted Aug 10, 2019, 3:45 AM
Faisal Pathan
Faisal PathanPosted Aug 10, 2019, 3:41 AM
Denmark PusoPosted Aug 10, 2019, 3:35 AM
Faisal Pathan
Faisal PathanPosted Aug 10, 2019, 2:27 AM