I have a custom user control that I am adding to a page via the front end (not back). That customer user control has a property that is of the type of a custom class. I would like to set that property via the declaration of the user control on the front end.
Here's some code to help you understand what I'm talking about:
In the custom user control .cs:
public BaseTUDSectionControl parentSectionControl
{
get;
set;
}
And at the declaration of an instance of that user control:
<tud:TUDDropDown ID="tddAccountExecutive" runat="server" />
I would like to set the parentSectionControl property in the same line, like this:
<tud:TUDDropDown parentSectionControl=someClassInstance
ID="tddAccountExecutive" runat="server" />
where 'someClassInstance' is a class instance that does exist... yeah. I think I am going about this the wrong way, but I don't know how else to accomplish this. I don't want to do it on the back end for maintenance reasons as I'll have hundreds of similar user controls added all throughout my project.
Is anything like this possible, or am I smoking something?
No that's not possible. You can only set property of basic types (int, string, bool) etc. from the markup (what you call front-end). If you have a property which is to be set to an instance of a class, this has to be done in the code-behind (what you call back-end).