I need to pass the value to jQuery in the view using viewbag. What I want to achieve is pass the null or some value and then jQuery should hide or show the div depending on the value passed for instance something like below:
viewbag.testNumber = null;
$('#showdiv').hide();
$('viewbag.testNumber').value == someinteger{
$("#showdiv").show();
else
$("#showdiv").hide();
});
<div id="showdiv"> Some Calculation </div>
Also I want to disable the viewbag in the view if the value is null , because it gives null error
ViewBag is only in ASP.NET MVC 3 so you can’t use that, but you can use ViewData: