What is the syntax to wire up Server-Side events (e.g. PreEdit) in .NET?
What is the syntax to wire up Server-Side events (e.g. PreEdit) in .NET?
The C# syntax for the editor is really unclear and its difficult to find actual examples that are not in php. This is a basic editor config I built based off the manual/examples on this site. Since everything is chained together I assumed that I could just tack on .PreEdit += (sender, e) => SomeMethod() to the end but that .Data() makes it such that 'editor' variable is no longer the actual editor, its the DtResponse object. I tried decoupling all this chaining but it just errors out with a cryptic js error in the console and I get no data. Can you please provide an example based on the following where a PreEdit even is added to this editor? Thanks.
var editor = new Editor(db, "User", "UserId")
.Model<User>()
.Field(new Field("name")
.Validator(Validation.NotEmpty())
)
.Field(new Field("username")
.Validator(Validation.NotEmpty())
)
.Field(new Field("email")
.Validator(Validation.Email())
)
.Field(new Field("isActive")
.Validator(Validation.Boolean())
)
.TryCatch(false)
.Process(request)
.Data();
Answers
You need to split the chain. So you might do:
See also the examples in the documentation.
Allan
Yep that works fine Allan, thanks for the help!