public class AboutUsController : Controller { public ActionResult Index() { CMSAboutus dbhandle = new CMSAboutus(); ModelState.Clear(); return View(dbhandle.GetAboutTitlepage().ToList()); }
My Class
public List<CMSAboutus> GetAboutTitlepage() { connection(); List<CMSAboutus> studentlist = new List<CMSAboutus>(); SqlCommand cmd = new SqlCommand("GetAboutpagetitle", con); cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.AddWithValue("@ID", smodel.id); SqlDataAdapter sd = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); con.Open(); sd.Fill(dt); con.Close(); foreach (DataRow dr in dt.Rows) { studentlist.Add( new CMSAboutus { // Id = Convert.ToInt32(dr["Id"]), Section_Title = Convert.ToString(dr["Section_Title"]), Title_desc = Convert.ToString(dr["Title_desc"]), }); } return studentlist; }
<pre>@using GlobalxVisa_Immigration.Areas.Admin.Models @model CMSAboutus @{ ViewBag.Title = "Index"; Layout = "~/Areas/Admin/Views/Shared/_LayoutRegister.cshtml"; } <div class="container"> <br /> <div class="row"> <div class="modal-content"> <div class="card-header bg-primary"><span style="color:white;">About Page Title</span></div> <div class="card-body"> <section> @using (Html.BeginForm("Index", "AboutUs", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { @Html.AntiForgeryToken() <h5> class="fa fa-link"> </h5> <hr /> if (Model.GetAboutTitlepage() != null && Model.GetAboutTitlepage().Count > 0) {
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)