I need to create some error handling/manager without try/catch. The question is, how can get errors inside event in another class through BoundDataChanged? Since I need bound data.
Index.cshtml
@model controlData
...
@Control.Bind(model).GetHtml();
class public Control{
public List<Error> Errors{get;set;}
public int Width {get;set;}
public BoundDataChangedEventHandler BoundDataChanged {get;set;}
public control(ControlConfiguration config){
Width = config.width;
BoundDataChanged = (sender, args) => {
//The problem come here, this event only rises when I have Bind in my cshtml.
//And there is the only way to get bound data.
}
ErrorManager.getErrorsControl(this);
}
public class ErrorManager{
public List<Error> getErrorsControl(Control con){
List<Error> errors = new List<Error>();
if (con.width>1000){
errors.Add(new Error(){...});
}
if newError...
if newError...
return errors;
}
//Here how can I manage BoundDataChanged ??
}
Aucun commentaire:
Enregistrer un commentaire