mvc Field.SetValue()
mvc Field.SetValue()
montoyam
Posts: 568Questions: 136Answers: 5
in DataTables
I know I can use render on the client side, but is there a way in the controller to use a function to return a value for a read only field.
.Field(new Field("Units")
.SetValue(
if (Fund == "All") {
return this
} else { return that }
)
.Set(false)
)
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Yes - have a
GetValue
as a simple string and then pass it through a get formatter to do the dynamic calculation (since that can be given as an anonymous function).Also, you'd want to use
GetValue()
in this case, not a set. Get in this context is reading from the server to the client (browser), while Set is what is set to the database.So
will hopefully do it for you.
Allan