I am trying to update list field using ItemAdding,
public override void ItemAdding(SPItemEventProperties properties)
{
SPListItem curListItem = properties.ListItem;
curListItem.Web.AllowUnsafeUpdates = true; // This property should be set to true for the update to go through
curListItem["Age"] = "";
curListItem.Update(); // This line should update the ListItem but it doesnt
}
UPDATE
public override void ItemAdding(SPItemEventProperties properties)
{
string empty = "";
properties.AfterProperties["Age"] = empty;
base.ItemAdding(properties);
}
ItemAdding
notItemUpdated
in the code.