I would like to expose a complex property from a custom ASP.NET user control, in such a way that it can be set from the control tag in the aspx page.
Something like this:
public class TestData {
public int X;
public int Y;
}
public partial class TestControl : System.Web.UI.UserControl {
public TestData TestProperty {
get {
return ViewState["TestProperty"] as TestData;
}
set {
ViewState["TestProperty"] = value;
}
}
}
And then in the .aspx file of a page that contains the control I would like to have something like:
<div>
<testns:TestControl runat="server" ID="TestControl1" TestProperty="X:1,Y:2"/>
</div>