I have created a user control which exposes a custom type property called SoftwareItem. The page where I have placed this user control has a page property of the same type. I cannot figure out how to pass the page's property to the user control. I understand that this can be done in the code_behind but wanted to set the property declaratively to avoid view state issues with setting this property in the code behind.
+2
A:
In the code behind for the user control, do you have the property defined as the custom type?
As in:
public MyCustomType SoftwareItem {get; set;}
David Stratton
2009-09-23 21:54:20
If your MyProperty variable isn't a standard int/string/etc. you may need to do the actual setting in your code behind file on page load as opposed to doing it "inline."
Dillie-O
2009-09-23 21:57:14
@Dillie-O If you can't do it inline how would someone *easily* maintain view_state?
ahsteele
2009-09-23 22:07:29