Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a web part page with .net controls like various fields textbox, choice fields, multiple line of text. User have to fill those fields. There is save buttons. These controls/fields are there in sharepoint list also. When user fill all fields like name, number, country etc and click on save these data need to get save in sharepoint list in respective columns.

Can you please tell me code for the same.Thanks

share|improve this question
    
This is not a good question, please tell us what you have tried and any references you have searched out. –  Aboba Jun 27 at 15:12

1 Answer 1

up vote 0 down vote accepted

You can use server side object model to add items to your list on button click:

SPWeb mySite = SPContext.Current.Web;
SPListItemCollection listItems = mySite.Lists[TextBox1.Text].Items;

SPListItem item = listItems.Add();

item["Title"] = TextBox2.Text;
item["Stock"] = Convert.ToInt32(TextBox3.Text);
item["Return Date"] = Convert.ToDateTime(TextBox4.Text);
item["Employee"] = TextBox5.Text;

item.Update();
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.