Reputation: 103607
If I have a inline user control page, are public properties... properties on the control?
<%@ Control language=C# %>
<script runat=server>
public string Title {get;set;}
</script>
ie. if someone loads the control by tag or programatically, they will see those public properties?
Upvotes: 0
Views: 297
Reputation: 15535
Yes.
However, if your user control is cached (with the @OutputCache directive), they won't, as ASP.NET will treat your control as a PartialCachingControl
(even casting to UserControl
won't work here). If you want to parameterize your user control, don't cache it. (But cache the page entirely for instance.)
Also note that if you're using LoadControl
, you'll first need to cast the instance you receive to the proper user control type, otherwise the only way to use the properties is by using a) reflection, or b) late binding (VB.NET can do that for you IIRC).
Upvotes: 2