I'd like to know how to get values from SharePoint list column in custom WebPart and I want to display it in the visual webPart.
splist lists = web.list["list name"];
spitem item = list.additem();
item["Title"] = "doc";
item["No"] = "1";'
I can use code something similar to the above to assign value in list column from visual WebPart. Is there a solution for the other way around — to get the value from SharePoint list and display it in visual WebPart?
Best Answer
there are lots of examples to populate a literal,label etc with the content of a list. you also might want to filter what you want to display. This is some code to get you started, if you require a more precise result just let us know what is the final result you wish to achieve: