Hi,Can anyone help?I have a table with many records which are having 'Approved' column value either 'true' or 'false'. I want to show all the records with Approved column value 'true' in a table and all the records with Approved column value 'false' in another table in the same view. I have two vertical tabs 'Approved' and 'Not Approved'. On click of Approved tab, I want to Show the Approved records table and on click of 'Not Approved' I want to show the not approved records table. Please tell me how to pass these two set of records from the controller to the same view? Is that possible?
Thanks in advance.
Dharmendra SinghPosted Jan 15, 2014, 3:57 AM
Suppose I have a simple records
Id Name Status
1 Ram true
2 Shyam false
on model
public ABC
{
public int Id{get; set;}
public string Name{get; set;}
public bool Status{get; set;}
}
on Controller
List
items.Add(new ABC{Id=1,Name="Ram",Status=true});
items.Add(new ABC{Id=2,Name="Shyam",Status=false});
ViewBag.dyProp = items;
you should use on view
@foreach(var item in ViewBag.dyProp)
{
if(item.Status)
{
// add approved values
}
}
@foreach(var item in ViewBag.dyProp)
{
if(!(item.Status))
{
// add not approved values
}
}