Guest User

Guest User

  • Tech Writer
  • 611
  • 126.4k

Null Value face error in mvc.

Sep 16 2020 12:28 PM
public async Task<IActionResult> EducationalI(EducationalImageViewModel obj_Parameter, IFormFile EducationImage)-But I have a issue here Null Value.
 
i have use this upload file use this html code.
  1. @using (Html.BeginForm("EducationalI""EducationalManagement", FormMethod.Post, new { id = "CreateForm", enctype = "multipart/form-data" }))  
  2. {  
  3. <div class="modal-content">  
  4. <div class="modal-header">  
  5. <h5 class="modal-title has-icon ms-icon-round "> Add New Image</h5>  
  6. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>  
  7. </div>  
  8. <div class="modal-body dnnn">  
  9. <form method="post">  
  10. <div class="ms-form-group">  
  11. <label for="img">Select image: </label>   
  12. @Html.TextBoxFor(x => x.Image, new { @type = "file", @id = "image", @name = "EducationImage", @accept = "image/*", @required = "required" })  
  13. </div>  
  14. @Html.ValidationMessageFor(x => x.Image, ""new { @class = "text-danger" })  
  15. <div class="ms-form-group has-icon">  
  16. <label for="choosecategory">Image Title</label>  
  17. @Html.TextBoxFor(x => x.Title, new { @type = "text", @id = "ImageName", @class = "form-control", @placeholder = "Enter Title", @required = "required" })  
  18. @*<input type="text" class="form-control" placeholder="Enter your Category">*@  
  19. </div>  
  20. @Html.ValidationMessageFor(x => x.Title, ""new { @class = "text-danger", @style = "color:red;!important" })  
  21. <div class="ms-form-group has-icon">  
  22. <label for="choosecategory">Image Description</label>  
  23. @Html.TextBoxFor(x => x.Description, new { @type = "text", @id = "ImageDescription", @class = "form-control", @placeholder = "Enter Description", @required = "required" })  
  24. @*<input type="text" class="form-control" placeholder="Enter your Category">*@  
  25. </div>  
  26. @Html.ValidationMessageFor(x => x.Description, ""new { @class = "text-danger", @style = "color:red;!important" })  
  27. </form>  
  28. </div>  

Answers (1)