I have a custom web part which have lot of fields that will be filed out by user and on submit is there a way that i can populate these values into a SharePoint list .I don't want to use info path as the web part also has lot of C# code in the background
SPWeb app = SPContext.Current.Web;
SPList ListName = app.Lists["Communities Directory"];
SPListItem ListItem = ListName.Items.Add();
string[] UsersSeperated = pickAdministrators.CommaSeparatedAccounts.Split(',');
SPFieldUserValueCollection UserCollection = new SPFieldUserValueCollection();
foreach (string UserSeperated in UsersSeperated)
{
app.EnsureUser(UserSeperated);
SPUser User = app.SiteUsers[UserSeperated];
SPFieldUserValue UserName = new SPFieldUserValue(app, User.ID, User.LoginName);
UserCollection.Add(UserName);
}
ListItem["Contact Person"] = UserCollection;