Okay, this is very easy, all you need to do is implement the esCreateEntity event. You don't even have to delete the object. Look at the samples that come with ES2008, the esDataSource samples. Here's a sample implementation:
Code:
protected void EsDataSource1_esCreateEntity(object sender, EntitySpaces.Web.esDataSourceCreateEntityEventArgs e)
{
Employees entity = new Employees();
if (e.PrimaryKeys != null)
{
entity.LoadByPrimaryKey((int)e.PrimaryKeys[0]);
}
// Assign the Entity
e.Entity = entity;
}
In fact, if you just add the delete/update buttons ES will do the rest, it will auto save and delete if you just implement the esCreateEntity event. You don't have to implement the Update or Delete events.
On my GridView I have these properties and it saves and deletes without me doing anything other than implementing the above event.
Code:
<asp:CommandField ShowEditButton="True" ShowSelectButton="True" ShowDeleteButton="true" ButtonType="Button" InsertVisible="False" >
Also, with the ES2008 Release Candidate released yesterday you don't even have to set the esDataSource.TotalRowCount as it should be done for you now.
EntitySpaces |
Twitter |
BLOG | Please honor our Software License