Hi Frnds,
I am new to MVC application , in my application am using viewbag here is the code
if ('@ViewBag.DTTime' != null && '@ViewBag.DTTime' != "") {
$('#Containerdiv').val('@ViewBag.DTTime.ToString("yyyy-MM-dd HH:mm:ss.fff", System.Globalization.CultureInfo.InvariantCulture)');
}
in Controller not assigning the viewbag DTTime, it is error..
this if statement always true and the statement is executed,
how to stop,
Thanks in Advance.
Loading
Saineshwar BageriPosted Nov 20, 2014, 7:32 AM
{
if (ModelState.IsValid)
{
ViewBag.DT = DateTime.Now;
}
else
{
ViewBag.DT = "";
}
return PartialView("_PartialView", SomeModel);
}
Santhosh SubramaniamPosted Nov 20, 2014, 5:26 AM
{
SomeCode here ...
if (model.isSuccess) {
ViewBag.DT= DateTime.Now.GetParmsTime();
}
else
{
ViewBag.DT= '';
}
return PartialView("_PartialView", SomeModel);
}
For your reference
Saineshwar BageriPosted Nov 19, 2014, 11:46 PM