Vidhi Patel

Vidhi Patel

  • NA
  • 44
  • 17.7k

Not retry grid data from database use entity framework

Sep 15 2016 7:28 AM
 
my controller:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MyWealthFirst.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/
WTAutoEntities1 e = new WTAutoEntities1();
public ActionResult Home()
{
return View();
}
public ActionResult About()
{
return View("");
}
public ActionResult Details()
{
return View(e.Companies.ToList());
}
}
}
cshtml page code:
@model MyWealthFirst.Company
@{
ViewBag.Title = "Details";
Layout = "~/Views/Shared/_LayoutPage.cshtml";
}
<h2>Details</h2>
<fieldset>
<legend>Company</legend>
<div class="display-label">
@Html.DisplayNameFor(model => model.cName)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.cName)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.Arn)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.Arn)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.address)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.address)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.street)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.street)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.area)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.area)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.city)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.city)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.pincode)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.pincode)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.state)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.state)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.phone1)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.phone1)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.phone2)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.phone2)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.mobile)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.mobile)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.fax)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.fax)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.PAN)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.PAN)
</div>
<div class="display-label">
@Html.DisplayNameFor(model => model.eMail)
</div>
<div class="display-field">
@Html.DisplayFor(model => model.eMail)
</div>
</fieldset>
<p>
@Html.ActionLink("Edit", "Edit", new { id=Model.Id }) |
@Html.ActionLink("Back to List", "Index")
</p>
 

Answers (1)