Skip to content
Loading
update operation for image uploading
                  • @using (@Html.BeginForm("EditData", "Home", FormMethod.Post))
                    {
                    @Html.AntiForgeryToken();
                    @Html.HiddenFor(model=>model.Candidate_Id)
                    Application Entry
                     
                    Condidate's Name  
                    @Html.TextBoxFor(model => model.Name, new { @required = "required" })

                    Note 1:  [as per 10th certificate]
                    Note 2:  [Please do not use any prefix such as Mr. or Ms. etc.]
                    Father's Name
                    @Html.TextBoxFor(model => model.Father_Name, new { @required = "required" })
                    Recent Color Photograph
                    @Html.TextBoxFor(model => model.Photograph, new { @type = "file", @id = "photograph", @onchange = "showimagepreview(this)", @class = "form-control" })
                    @if ((Model.Photograph) != null)
                    {
                     brand image
                    }
                    Condidate's Signature
                    @Html.TextBoxFor(model => model.Candidate_signature, new { @type = "file", @id = "candi_sign", @onchange = "showimagepreviews(this)", @class = "form-control" })
                    @if ((Model.Candidate_signature) != null)
                    {
                     brand image1
                    }
                    Gender
                    @Html.DropDownListFor(model => model.Gender,
                    new List
                    {
                    new SelectListItem{Value="Male",Text="Male"},
                    new SelectListItem{Value="Female",Text="Female"},
                    }, new { @class = "span6" })
                    Date Of Birth
                    @Html.TextBoxFor(model => model.DOB, new { @id = "datepicker", @type = "date" })
                    Note 1:  [Date of Birth as recorded in the Matriculation/Secondary Certificate]
                    Select Course
                    @Html.DropDownListFor(model => model.course,
                    new List
                    {
                    new SelectListItem{Value="0",Text="Select"},
                    new SelectListItem{Value="1",Text="MBA"},
                    new SelectListItem{Value="2",Text="B.TECH"},
                    new SelectListItem{Value="3",Text="POLYTECHNIC"}
                    }, new { @class = "span6", @onchange = "SelectedIndexChanged()" })
                    @*@Html.DropDownList("AddData", ViewData["course"] as List)*@


                    IF You Are Appearing Condidate
                    @Html.DropDownListFor(model => model.appearing_class,
                    new List
                    {
                    new SelectListItem{Value="0",Text="select"},
                    }, new { @class = "span6", @id = "AppearingClass", @name = "AppearingClass" })
                    @**@

                    Educational Qualification

                    A. % of Class 10th
                    @Html.TextBoxFor(model => model.highschool, new { @class = "span6", @id = "10textbox", @name = "highschooltextbox", }) %
                         Passing Year of Class 10th
                    @Html.DropDownListFor(model => model.Passing_Year_10,
                    new List
                    {
                    new SelectListItem{Value="2010",Text="2010"},
                    new SelectListItem{Value="2011",Text="2011"},
                    }, new { @class = "span6", @id = "dropdown10", @name = "highschooldropdown" })
                    B. % of Class 12th
                    @Html.TextBoxFor(model => model.Intermediate, new { @id = "12textbox", @name = "intermediatetextbox" }) %
                         Passing Year of Class 12th
                    @Html.DropDownListFor(model => model.Passing_Year_12,
                    new List
                    {
                    new SelectListItem{Value="2010",Text="2010"},
                    new SelectListItem{Value="2012",Text="2012"},
                    }, new { @class = "span6", @id = "12dropdown", @name = "intermediatedropdown" })
                    C. % of Graduation
                    @Html.TextBoxFor(model => model.Graduation, new { @id = "grad", @name = "gradtextbox" }) 
                         Passing Year of Graduation
                    @Html.DropDownListFor(model => model.Passing_Year_Grad,
                    new List
                    {
                    new SelectListItem{Value="2010",Text="2010"},
                    new SelectListItem{Value="2011",Text="2011"},
                    }, new { @class = "span6", @id = "graddropdown", @name = "graduationdropdown" })
                    Condidate's Contact No 1.
                    @Html.TextBoxFor(model => model.Contact_No1)
                    Condidate's Contact No 2.
                    @Html.TextBoxFor(model => model.Contact_No2)
                    Condidate's Email-ID
                    @Html.TextBoxFor(model => model.Email_Id)
                    Place Of Residence
                    @Html.DropDownListFor(model => model.Residence,
                    new List
                    {
                    new SelectListItem{Value="Village",Text="Village"},
                    new SelectListItem{Value="Town",Text="Town"},
                    })
                    Choice Of Exam Centre code
                    1.  Choice @Html.TextBoxFor(model => model.Exam_center_code)
                    Category
                    @Html.DropDownListFor(model => model.Category,
                    new List
                    {
                    new SelectListItem{Value="GEN",Text="GEN"},
                    new SelectListItem{Value="OBC",Text="OBC"},
                    new SelectListItem {Value="SC", Text = "SC" },
                    new SelectListItem{Value="ST",Text="ST"},
                    })
                    Occupation Of Parent / Guardian
                    @Html.DropDownListFor(model => model.Occupation_father,
                    new List
                    {
                    new SelectListItem{Value="Aggriculture",Text="Aggriculture"},
                    new SelectListItem{Value="Bussiness",Text="Bussiness"},
                    new SelectListItem {Value="Private", Text = "Private" },
                    })
                    Total Annual Income Of Parent / Guardian
                    @Html.DropDownListFor(model => model.Income,
                    new List
                    {
                    new SelectListItem{Value="1,00,000",Text="1,00,000"},
                    new SelectListItem{Value="1,00,000-3,00,000",Text="1,00,000-3,00,000"},
                    new SelectListItem {Value="3,00,000 - 6,00,000", Text = "3,00,000 - 6,00,000" },
                    new SelectListItem {Value="Above 10,00,000", Text = "Above 10,00,000" },
                    })
                    District / City
                    @Html.TextBoxFor(model => model.City)
                    State
                    @Html.TextBoxFor(model => model.State)
                    Condidate's Mailing Address 1
                    @Html.TextBoxFor(model => model.Mail_Id1)
                    Condidate's Mailing Address 2
                    @Html.TextBoxFor(model => model.Mail_Id2)

                    Declaration

                    I hereby declare that all the particulars stated in the application form are true to the best of my knowledge and belief. I have read the MSJEE Information Brochure and I shall abide by the terms & condition their in.

                    I agree with all condition.


                    }
                    Copyright © 2014, comed-i. All Rights Reserved.
                  • Ramesh Palanivel
                    Hi Indu,
                     
                    Kindly share your HTML page also. How you are trying to post the model to controller.. 
                  •  Hello Sir
                    Please check my code........ 
                     
                    [HttpGet]
                    public ActionResult EditData(int Candidate_Id)
                    {
                    var image = context.Applications.Find(Candidate_Id);
                    if (image == null)
                    {
                    return new HttpNotFoundResult();
                    }
                    var model = new Application
                    {
                    Name = image.Name,
                    Father_Name=image.Father_Name,
                    Photograph=image.Photograph,
                    Candidate_signature=image.Candidate_signature,
                    Gender=image.Gender,
                    DOB=image.DOB,
                    course=image.course,
                    appearing_class=image.appearing_class,
                    Contact_No1=image.Contact_No1,
                    Contact_No2=image.Contact_No2,
                    Email_Id=image.Email_Id,
                    Residence=image.Residence,
                    Exam_center_code=image.Exam_center_code,
                    Category=image.Category,
                    Occupation_father=image.Occupation_father,
                    Income=image.Income,
                    City=image.City,
                    State=image.State,
                    Mail_Id1=image.Mail_Id1,
                    Mail_Id2=image.Mail_Id2,
                    };
                    return View(model);
                    }
                    [HttpPost]
                    [ValidateInput(false)]
                    public ActionResult EditData(Application model, int Candidate_Id)
                    {
                    if (ModelState.IsValid)
                    {
                    var image= context.Applications.Find(Candidate_Id);
                    if (image == null)
                    {
                    return new HttpNotFoundResult();
                    }
                    image.Name=model.Name;
                    image.Father_Name=model.Father_Name;
                    image.Photograph=model.Photograph;
                    image.Candidate_signature=model.Candidate_signature;
                    image.Gender=model.Gender;
                    image.DOB=model.DOB;
                    image.course=model.course;
                    image.appearing_class=model.appearing_class;
                    image.Contact_No1=model.Contact_No1;
                    image.Contact_No2=model.Contact_No2;
                    image.Email_Id=model.Email_Id;
                    image.Residence=model.Residence;
                    image.Exam_center_code=model.Exam_center_code;
                    image.Category=model.Category;
                    image.Occupation_father=model.Occupation_father;
                    image.Income=model.Income;
                    image.City=model.City;
                    image.State=model.State;
                    image.Mail_Id1=image.Mail_Id1;
                    image.Mail_Id2=image.Mail_Id2;
                    if (model.Photograph != null)
                    {
                    var imagePath = Path.GetFileName(image.Photograph);
                    var imageUrl = System.IO.Path.Combine(Server.MapPath("~/PICS/"), imagePath);
                    image.Photograph = imageUrl;
                    }
                    context.SaveChanges();
                    return RedirectToAction("Index");
                    }
                    return View(model);
                    }
                  • Vivek Kumar
                    Hi,
                    You have to check the action parameter. Check the below links.
                     
                    https://docs.microsoft.com/en-us/aspnet/web-api/overview/formats-and-model-binding/parameter-binding-in-aspnet-web-api