Reputation: 4277
When I use the following, I get this. Why does it not just return the exact value and not show the rest. I just want it to show "CVC" and "ACLYAU", instead of "{ Value = ACLYAU }" and "{ Value = ACLYAU }". When I try to pass this to my controller it breaks.
@Html.Hidden("princid", new { @Value = (@TempData["PrincId"]) })
@Html.Hidden("custid", new { @Value = (@TempData["CustId"]) })
<script>
var val = $("#princid").val();
var val2 = $("#custid").val();
alert(val);
alert(val2);
</script>
result
===> "{ Value = CVC }"
===> "{ Value = ACLYAU }"
desired output
"CVC"
"ACLYAU"
Upvotes: 1
Views: 66
Reputation: 4243
Try replacing this:
@Html.Hidden("princid", new { @Value = (@TempData["PrincId"]) })
@Html.Hidden("custid", new { @Value = (@TempData["CustId"]) })
by this:
@Html.Hidden("princid", (object)@TempData["PrincId"])
@Html.Hidden("custid", (object)@TempData["CustId"])
Upvotes: 1