I have three projects in the solution
DynamicDataWeb
BLL
LLBL
all the bussiness logic is in BLL project, LLBL doesn't have reference to BLL.
Now it's
protected void DetailsDataSource_EntityUpdating(object sender, CancelableDataSourceActionEventArgs e)
{
string error;
if (!Bll.ValidationLogic.Validate(e.InvolvedEntity, out error))
{
Utils.RegisterJScriptAlert(error);
e.Cancel = true;
}
}
What I want:
protected void EntityValidator_Validate(object sender, ServerValidateEventArgs args)
{
string error;
args.IsValid = Bll.ValidationLogic.Validate(DetailsDataSource.Entity, out error);
(sender as CustomValidator).ErrorMessage = error;
}
protected void btnSave_Click(object sender, EventArgs e)
{
DetailsView1.UpdateItem(true); //will not update item if Page.IsValid == false
}
where DetailsDataSource.Entity in EntityValidator is what I want to get.
But there could be many scenarios when an Enity created from DataSource and user inputs in DetailsView would be cool.