BindValue to a Method
- We want that whenever the user changes the value for the
FromDatecolumn, the value of theToDatecolumn will automatically recompute to the "End of Month" of the date in theFromDatecolumn - Review the second overload of the
BindValuemethod.

- Func
<Date>means a method that returnDate - see Func Power Point Presentation
public class DemoLocalColumns : UIControllerBase
{
public readonly DateColumn FromDate = new DateColumn("From Date");
public readonly DateColumn ToDate = new DateColumn("To Date");
public readonly NumberColumn DaysBetween = new NumberColumn("Days Between","5CN");
public DemoLocalColumns()
{
ToDate.BindValue(GetEndOfMonthOfFromDate);
}
public Date GetEndOfMonthOfFromDate()
{
return FromDate.EndOfMonth;
}
...
}
- Note that we are sending the method
GetEndOfMonthOfFromDateas a parameter to theBindValuemethod without parenthesis - Use
Debug.WriteLineto demonstrate that theGetEndOfMonthOfFromDatemethod calculates whenever we change theFromDatecolumn
For a deeper discussion of these topics see Lambda Expressions Generics and BindValue
Help us improve, Edit this page on GitHub
or email us at info@fireflymigration.com