Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a GenericList object data like below

C#
List<mydata> genList= new List<mydata>();

genlist = GetGenListData(parameter);




This is i am able to display in mvc view byusing foreach that data.

C#
@model app.Model.Class


foreach(var da in Model.List)
{}



Here my query is I want to display same thing by using ListItme class object like below

C#
ListItem genList= new ListItem();

genlist = GetGenListData(parameter) as List<mydata>;


View

C#
@model app.Model.Class


foreach(var da in Model.List)
{}



But this model is not wotking /binding the data into appropriate view.
Posted
Updated 21-Jan-16 21:30pm
v3
Comments
BillWoodruff 22-Jan-16 5:04am    
The 'ListItem collection holds what Type object ? 'object ? 'ListViewItem ?
DGKumar 22-Jan-16 6:38am    
only some properties
Like
Class ListItems
{
Public int P1{get;set;}

......
}


Another class
Class Node
{
public List<<items>> GetList {get;set;}
public ListItems ListItems{get;set;}
}



Node objNode=new Node();

objNode.GetList=GetlistfromModel();

objNode.ListItems=objNode.GetList;


I want to store List<dat> into Listitems calss property
BillWoodruff 22-Jan-16 22:13pm    
Sorry, I am having real trouble understanding your code ... from what is shown here. Why do you declare an instance of 'genList, and then ignore that by setting its value to the result of calling 'GenListData() ? What's the connection/use of both 'genList and 'ListItems ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900