7
Answers

How to bind data from database to table, getting error..

am getting error when am binding data to table from database
An exception of type 'System.ArgumentException' occurred in System.Web.Mvc.dll but was not handled in user code
Additional information: Value cannot be null or empty.
 
my controller 
 
var data = new List<Accounting_PendingBills>();
TestDemoEntities db = new TestDemoEntities();
data = db.Accounting_PendingBills.Where(x=>x.Party=="86").ToList();
return View(data);
 
 view page
 
@model IEnumerable<AccountsPageLayout.Accounting_PendingBills>
@using System.Web.Mvc;
@using AccountsPageLayout.Models;
@{
ViewBag.Title = "pendings";
Layout = null;
}
<div id="popupdiv" title="Basic modal dialog">
<table align="center" class="tbldata" border="0" cellpadding="0" cellspacing="0">
<tr>
<th>Customer</th>
<th>Amount</th>
<th>Pendings</th>
<th>Pending Value</th>
<th>Pending Adjusted</th>
<th>Account Name</th>
</tr>
@foreach (AccountsPageLayout.Accounting_PendingBills emp in @Model)
{
<tr>
<td>@Html.TextBox("", emp.Amount) </td>
<td>@Html.TextBox("", emp.Amount)</td>
<td>@Html.TextBox("", emp.Amount)</td>
<td>@Html.TextBox("", emp.Amount)</td>
<td>@Html.TextBox("", emp.Amount)</td>
<td>
 

Answers (7)