samedi 30 juillet 2016

how to send true/false value through checkbox in razor

Here is my Razor View :-

@model _24By7CallAndBPOPvtLtd.Models.Job_Det
           ............
 <div class="form-group">
                @Html.LabelFor(model => model.Picture_id, "Picture Required?", htmlAttributes: new { @class = "control-label col-md-2" })
                <div class="col-md-10">
                   @Html.CheckBox("Picture_Required", model => model.Picture_id.Picture_Required)
                </div>
            </div>
<div class="form-group">
                <div class="col-md-offset-2 col-md-10">
                    <input type="submit" value="Create" class="btn btn-default" /></div></div>

Here is my table:-

public partial class Picture
    {
public Picture()
    {
        this.Job_Applied = new HashSet<Job_Applied>();
        this.Job_Det = new HashSet<Job_Det>();
    }

    public int Picture_Id { get; set; }
    public string Pic_Path { get; set; }
    public Nullable<bool> Picture_Required { get; set; }

    public virtual ICollection<Job_Applied> Job_Applied { get; set; }
    public virtual ICollection<Job_Det> Job_Det { get; set; }
}

i need to send true/false value to picture table by check/uncheck the checkbox.. please help me




Aucun commentaire:

Enregistrer un commentaire