Hi AliYilmaz,
Check this example. Now please take its reference and correct your code.
Model
public class VideoModel
{
public string VideoYolu { get; set; }
}
Controller
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
List<VideoModel> videos = new List<VideoModel>();
videos.Add(new VideoModel { VideoYolu = "Test" });
videos.Add(new VideoModel { VideoYolu = null });
videos.Add(new VideoModel { VideoYolu = "Test 1" });
return View(videos);
}
}
View
@model IEnumerable<_Show_Hide_Div.Models.VideoModel>
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
@foreach (var item in Model)
{
<div class="col-md-6" style="@(@item.VideoYolu == null ? "display:none" : "display:block")">
<h1>Video</h1>
Div <b>@item.VideoYolu</b>.
</div>
}
</body>
</html>
Screenshot