Home > DeveloperSection > Forums > How to add listview items in C#
Manoj Bhatt
Manoj Bhatt

Total Post:154

Posted on    July-17-2013 4:05 AM

 C# C# 

 1 Reply(s)
 1564  View(s)
Rate this:
Hi mindstick!

Hello I have some doubts in listveiw I have a listview with two columns, i want to add items to the first column which are given programmatically and the other column is from database... like

column1              column2

abc            from database

def                   "

 hij                    "

can this be done.... can any one help me out with this...

I am using C# ,visual studio........

thanks  in advance

shreesh chandra shukla
shreesh chandra shukla

Total Post:105

Posted on    July-17-2013 8:27 AM


I'm not sure how you want to match the programmatically added values and the db values, but you could create a new listitem for each of the database values i.e.

ListItem item = new ListItem("apple",[database value]);

Add the items to a collection


Then bind the collection to your control

ListView.DataSource = ItemCollection;

Don't want to miss updates? Please click the below button!

Follow MindStick