sourabh choubey

sourabh choubey

  • NA
  • 174
  • 46k

how to use ienumerable under which model class is present

Jul 14 2016 12:34 AM
My query is that i have data from database in datatable .
 
DataTable dt = OBJ.Fetch_PartDetails();
 
 
in dt i have all the records  .Now  i add all the records in list as
 
List<SecretaryUserModel> list = new List<SecretaryUserModel>();
for(int i=0;i<dt.Rows.Count;i++)
//foreach(var item in dt.Rows)
{
SecretaryUserModel GetAll = new SecretaryUserModel();
GetAll.TransactionDate = dt.Rows[i]["TransactionDate"].ToString();
GetAll.SLNo = Convert.ToInt32(dt.Rows[i]["SLNO"]);
GetAll.Particular = Convert.ToString(dt.Rows[i]["Particular"]);
GetAll.Balance = Convert.ToDecimal(dt.Rows[i]["Balance"]);
GetAll.Credit_Expenses = Convert.ToDecimal(dt.Rows[i]["Credit_Expenses"]);
GetAll.Debit_Expenses = Convert.ToDecimal(dt.Rows[i]["Debit_Expenses"]);
list.Add(GetAll);
}
and finally i send list to the view.
In top of the  view page  i declared it as
@model IEnumerable<ServiceCatalogue.UI.Areas.BMS.Models.SecretaryUserModel>
but when i call the object of  SecretaryUserModel the error come to me as 
 ienumerable<secretarymodel>does not contain a definition for fromdate and no extension........
 
 
 

Answers (7)