0

@moelname
@{
  
    Layout = "";
}


<input type="hidden" id="" value="@Model.modelproperty" />

here value not coming give your suggestions

p.sivakumar
  • 35
  • 2
  • 4

2 Answers2

5

This should be sufficient

Model

public class MyModel
{
    public bool MyBool { get; set; }
}

Controller

public ActionResult MyController()
{
    return View(new MyModel {MyBool = true});
}

View

@model MyModel
<input value="@Model.MyBool.ToString()" />
Webbanditten
  • 850
  • 9
  • 21
1

You need to use @Model.modelproperty.ToString() to get it right. Please refer this: ASP.NET MVC 5 renders different bool value for hidden input

Community
  • 1
  • 1
User3250
  • 2,961
  • 5
  • 29
  • 61