I have two user control (ASCX
) files in a SharePoint solution package. The controls are already working fine, but I've had to create 8 different page layouts for the various parameters that the control files accept in order to have the the desired data displayed on the various pages that will display them.
I'm wondering if there is any way to set the values of the control files' public fields in the edit mode of the page that uses the page layout in order to maximize modularity (this way I can have one page layout for each of the two user controls and set the parameters as needed at the publishing stage.) I guess I'm asking if it's possible to dynamically set control file parameters like this:
FieldParamValue = "SomeValue";
<UserControl:ControlTag ID="SomeControlFile" runat="server" MyFieldParameter=FieldParamValue />
and then have the FieldParamValue
be an editable option in the SharePoint published page while in edit mode.
You could do the opposite. On your user control, on init check the current page layout (using the PublishingPage object) and depending on the page layout, provision / adapt required properties of your user control.