Not able to set value of hidden field using viewbag when value is type of bool.
<p>Controller side i have </p>

<p><code>ViewBag.CanAddNewStudent = Convert.ToBoolean(Request.Cookies["SignInOption"]["Can Add New Student"].Split(',')[0]);</code></p>

<p>And at the view side i take Hidden field as</p>

<pre><code> &lt;input type="hidden" id="HiddenCanAddNewStudent" value="@ViewBag.CanAddNewStudent"&gt;
      &lt;label&gt;@ViewBag.CanAddNewStudent&lt;/label&gt; 
</code></pre>

<p>Here in Hidden field i get Value="value" instead of Boolean value.<a href="https://i.stack.imgur.com/SGqOa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SGqOa.png" alt="enter image description here"></a></p>