I have a custom control where I want to expose a method as a property ( e.g. for custom validation );
public Func<bool> ValidateMatrixFunc { get; set; }
then in the page that contains this custom control I can use a delegate or lambda exp to assign on OnPreInit event of the page;
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
ucMatrixTable.ValidateMatrixFunc = ValidateMatrix;
}
and this works.
However, I think it would be more convenient to do this in aspx, as in:
<uc1:MatrixTable ID="ucMatrixTable" runat="server" ValidateMatrixFunc="ValidateMatrix" />
But this crashes with the following message:
Cannot create an object of type 'System.Func`1[[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' from its string representation 'ValidateMatrix' for the 'ValidateMatrixFunc' property.
So, I just wonder... and i wonder.. if some ninja knows the answer to this, or it is just one of those mysteries of life we ll never get.