Itemdeleting event reciver
public override void ItemDeleting(SPItemEventProperties properties)
{
base.ItemDeleting(properties);
//listitem title name equal new that time event will fire
if (properties.ListItem["Title"].ToString() == "new")
{
properties.ErrorMessage = "Dont delete the item title starts with new";
// firing event will restrict the user any action will happen
properties.Cancel = true;
}
else
{
properties.Cancel = false;
}
//SPUtility.Redirect(properties.Web.Url, SPRedirectFlags.DoNotEndResponse, HttpContext.Current);
}
Itemadded event reciver
public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
SPListItem item = properties.ListItem;
//update only date for this column.if u add or update any data in the new date column..
item["newdate"] = DateTime.Now.ToString();
item.Update();
}
No comments:
Post a Comment