33 SharePoint Server Object Model
33 SharePoint Server Object Model
Style.css
.tbltopstyle
{
width: 600px;
}
.tbltopstyle th
{
font-family: Arial;
font-size: 23px;
background-color: #0e83cd;
color:#333;
}
.tbltopstyle td
{
font-family: Arial;
font-size: 18px;
color:#333;
}
.txtstyle
{
border: 1px solid #0e83cd;
width: 300px;
}
.spansuccess
{
font-family: Arial;
font-size: 18px;
color:#333;
font-weight:bold;
}
}
return listavailable;
}
protected void btnSave_Click(object sender, EventArgs e)
{
SPSite site = new SPSite(SPContext.Current.Site.Url);
SPWeb web = site.OpenWeb();
SPList list = web.Lists[listname];
SPListItem newitem = list.AddItem();
newitem["Title"] = txtEName.Text;
newitem["Father_x0020_Name"] = txtFName.Text;
newitem["Gender"] = ddlGender.SelectedItem.Text;
newitem["Salary"] = txtSalary.Text;
newitem.Update();
lblMsg.Text = "A new Employee with Employee ID:<span
class='spansuccess'>" + newitem.ID + "</span> is created Successfully";
}
Deploy
After deploying successfully, create new page and add corresponding webpart.
By that time, we can see new list called Employee_Corner.
Go and check in SiteContents.
After clicking on Employee_Corner.
The following output will be displayed.