3
Answers

ViewBag not working in MVC

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. 
Answers (3)