|
| This is my first go at trying to build a composite custom placeholder and I'm
stuck at trying to bind the child controls to relevant placeholder
definitions.
My composite custom placeholder code so far is as follows where the control
will contain both an image and some html/text:
public class IntroImageTextControl : BasePlaceholderControl
{
private HtmlPlaceholderControl _intoText;
private SingleImagePlaceholderControl _intoImage;
private PlaceHolder _presentationControl;
protected override void CreateAuthoringChildControls(BaseModeCon
tainer
authoringContainer)
{
this._intoImage = new SingleImagePlaceholderControl();
this._intoImage.ID = "introImage";
this._intoImage.DisplayHeight = 135;
this._intoImage.DisplayWidth = 135;
authoringContainer.Controls.Add(this._intoImage);
this._intoText = new HtmlPlaceholderControl();
this._intoText.ID = "introText";
this._intoText.EditControlHeight = 100;
this._intoText.EditControlWidth = 200;
authoringContainer.Controls.Add(this._intoText);
}
protected override void CreatePresentationChildControls(BaseMode
Container
presentationContainer)
{
this._presentationControl = new PlaceHolder();
this._presentationControl.ID = "PresentationControl";
presentationContainer.Controls.Add(this._presentationControl);
}
protected override void
LoadPlaceholderContentForAuthoring(Place
holderControlEventArgs e)
{
}
protected override void
LoadPlaceholderContentForPresentation(Pl
aceholderControlEventArgs e)
{
}
protected override void
SavePlaceholderContent(PlaceholderContro
lSaveEventArgs e)
{
}
}
The control compiles and I'm able to add it to my tool box and drag it onto
the designer.
I beleive I should bind the custom control to both a
HtmlPlaceholderControlDefinition and a SingleImagePlaceholderControl but am
not sure how to go about it. I've been unable to find any slick tutorials via
google. I have however bound a single control (unrelated to this problem) to
a single definition which I have added via the template properties as
desribed in the help files.
Also - eventually I aim to write this control so that a content author is
able to add or delete image/text placeholders sections - so I'm guessing the
two placeholder definitions for each image/text placeholder composite need
sto be added dynamically?
If this is possible could some one point me in the right direction ?
Thanks.
|
|