Can you pass two Values in preEdit in ASP.Net?
Can you pass two Values in preEdit in ASP.Net?
Is is it possible to to pass two Values in preEdit? Currently I have
editor.PreEdit += (sender, e) =>
editor.Field("EmpNumber").SetValue(e.Values["FirstName"]);
But I would like for it to combine the location number with the first name. So it would be 257Joe I am hoping I could do
editor.PreEdit += (sender, e) =>
editor.Field("Name").SetValue(e.Values["LocationNumber"]+["FirstName"]);
or something like that.
thank you
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Almost exactly that - you just need to use
e.Values
again for["FirstName"]
:Assuming
FirstName
is in the submitted data of course.Allan
I was getting the error "Operator '+' cannot be applied to operands of type object and object." Then I changed the code to
Now it works perfectly. Thanks Allan for pointing me in the right direction.
Ah yes - because the submitted data can be more or less anything, it is of the generic
object
type. Adding a casting method such asToString()
will do the job nicely.Allan