it's my data get code in mvc when page reload.
- public IActionResult EducationalVideo()
- {
- List
lst = new List (); - try
- {
- var Video = _context.TblEducationalVideo.ToList();
- if (Video != null)
- {
- foreach (var item in Video)
- {
- EducationalVideoViewModel lst_Data = new EducationalVideoViewModel();
- lst_Data.Name = item.Name;
- lst_Data.Video = item.VideoPath;
- lst.Add(lst_Data);
- }
- }
- else
- {
- ViewBag.message = "No Record !";
- }
- }
- catch(Exception ex)
- {
- ViewBag.message = "Internal Server Error";
- var message = ex.InnerException.Message;
- throw;
- }
- return View(lst);
- }
it's me viewmodel classes
- public class EducationalVideoViewModel
- {
- public string Name { get; set; }
- public string Video { get; set; }
- }
- public class EducationalVideoList
- {
- public List
lst_EducationData { get;set; } - public string Name { get; set; }
- public string Video { get; set; }
- public string Image { get; set; }
- }
it's view code
- @foreach (var item in Model.lst_EducationData)-Here i have face issue null value.
- {
class="Search"> @{ Srno++; } @Srno class="video-frame">- height="140" controls>
"http://nbpbaseball.harishparas.com/UploadVideo/@Url.Content(item.Video)" type="video/mp4">@Html.DisplayFor(x => item.Name) - "#" class="btn btn-danger">class="fa fa-trash"> Delete
- }

Varun SetiaPosted Aug 1, 2020, 6:43 AM