Create a new web project in Visual studioAdd reference to Microsoft.SharePoint.dll (you can find from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI)Create an new user control(.ascx)Import below namespaces
using Microsoft.SharePoint;
using Microsoft.SharePoint.Search;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;Insert Textboxes, buttons….whatever u requiredOn button click paste the code belowTo host the user control in sharepoint use smartpart from codeplex.
CODE SNIPPET
{
try
{
//create the object of SPSite
SPSite oSiteCollection = SPContext.Current.Site;
// SPSite oSiteCollection = new SPSite(“http://mysite:3434“);
//create the object of SPWeb with the help of SPSite object:
SPWeb oWebsiteRoot = oSiteCollection.OpenWeb();
oWebsiteRoot.AllowUnsafeUpdates = true;
//create the connection to the custom List and create object of SPListItemCollection
SPList oList = oWebsiteRoot.Lists[“MyListName”];
SPListItemCollection listItemCOll;
//add the item in the User List
SPListItem oListItem = oList.Items.Add();
oListItem[“Name”] = txtName.Text;
oListItem[“Email”] = txtEmail.Text;
oListItem[“Color”] = ddldropdown.SelectedItem;
oListItem[“AssignTo”] = txtAssignto.Text;
oListItem.Update();
}
catch (Exception ex)
{
lblError.Text = ex.Message.ToString();
}
}