SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 '14 at 15:12
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;

share|improve this answer

Your Answer


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.