|
Home > Archive > Microsoft Content Management Server > December 2006 > Is it possible to read placeholder content from within a custom placeholder ??
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Is it possible to read placeholder content from within a custom placeholder ??
|
|
| svdkooij 2006-12-08, 7:22 pm |
| Here is the situation:
I created a TextboxPlaceholderControl (actually it user S. Gossner's
control) and want to extend with a CheckBox. When checked the textbox
should be replaced with a DropDownList. All the content from that
placeholder of all the posting in the current channel should be loaded
into that DropDownList. Postings should have the same templates
ofcourse.
I noticed that CmsHttpContent is not allowed in a placeholder control
so that solution goed bye bye. I'm now thinking about storing those
lines of text in an xml or something..
Any ideas ?
Regards
S.
| |
| markcz 2006-12-09, 7:19 pm |
| Hallo, this is possible, but you should create your control which is
not CMS placeholder to make it. You can create composite asp.net
ocntrol with one dropdownlist what will be filled in PageLoad event (of
that contro) with Placeholders from posting from this collection
CmsHttpContext.Current.Posting.Placeholders.
enjoy,
Martin
svdkooij napsal:
> Here is the situation:
>
> I created a TextboxPlaceholderControl (actually it user S. Gossner's
> control) and want to extend with a CheckBox. When checked the textbox
> should be replaced with a DropDownList. All the content from that
> placeholder of all the posting in the current channel should be loaded
> into that DropDownList. Postings should have the same templates
> ofcourse.
>
> I noticed that CmsHttpContent is not allowed in a placeholder control
> so that solution goed bye bye. I'm now thinking about storing those
> lines of text in an xml or something..
>
> Any ideas ?
>
> Regards
> S.
| |
| svdkooij 2006-12-10, 7:20 am |
| It has to be an placeholder webcontrol otherwise there is no good way
to save the selected text to the BoundPlaceholder using the
"SavePlaceholderContent()" methode.
I managed to get the current channel from where to custom placeholder
is operationg using:
Channel channelCurrent = this.BoundPlaceholder.Posting.Parent as
Channel;
To get de DropDownList filled up I wrote the following code:
protected override void CreateAuthoringChildControls(BaseModeCon
tainer
authoringContainer)
{
if(this._autoFill) // _autoFill is public property set at design
time (bool)
{
Channel channelCurrent = this.BoundPlaceholder.Posting.Parent as
Channel; // get the current channel
this._editDropDownList = new DropDownList();
foreach( Posting p in channelCurrent.Postings)
{
string strPlaceholderContent =
((HtmlPlaceholder)p.Placeholders[this.PlaceholderToBind]).Html;
this._editDropDownList.Items.Add(new
ListItem(strPlaceholderContent, strPlaceholderContent));
}
authoringContainer.Controls.Add(this._editDropDownList);
}
else
{
// code when _autoFill is false (show normal textbox)
}
}
I just have to figure out how to switch between the textbox and de
dropdownlist. If the dropdownlist is always visible instead of the
textbox no new line can be entered.
markcz wrote:
> Hallo, this is possible, but you should create your control which is
> not CMS placeholder to make it. You can create composite asp.net
> ocntrol with one dropdownlist what will be filled in PageLoad event (of
> that contro) with Placeholders from posting from this collection
> CmsHttpContext.Current.Posting.Placeholders.
>
> enjoy,
> Martin
>
| |
| markcz 2006-12-11, 7:21 am |
| Hallo svdkooij,
yes, this is possible solution, but I thing you are not bringing any
new data (otherwise you need to save a specified date state of
postings) into a placeholder. And doing this, you will store your
placeholders (into this bounded one) from a last time posting is
edited. (I would recommend you to keep number of placeholders as low as
possible - just for performance)
And it is possible to save posting's placeholder in you custom control,
use similar way you are reading your posting placeholders data. It is
not necessary to put it into SavePlaceholderContent (just for your
info).
bye, Martin
svdkooij napsal:[vbcol=seagreen]
> It has to be an placeholder webcontrol otherwise there is no good way
> to save the selected text to the BoundPlaceholder using the
> "SavePlaceholderContent()" methode.
>
> I managed to get the current channel from where to custom placeholder
> is operationg using:
>
> Channel channelCurrent = this.BoundPlaceholder.Posting.Parent as
> Channel;
>
> To get de DropDownList filled up I wrote the following code:
>
> protected override void CreateAuthoringChildControls(BaseModeCon
tainer
> authoringContainer)
> {
> if(this._autoFill) // _autoFill is public property set at design
> time (bool)
> {
> Channel channelCurrent = this.BoundPlaceholder.Posting.Parent as
> Channel; // get the current channel
> this._editDropDownList = new DropDownList();
> foreach( Posting p in channelCurrent.Postings)
> {
> string strPlaceholderContent =
> ((HtmlPlaceholder)p.Placeholders[this.PlaceholderToBind]).Html;
> this._editDropDownList.Items.Add(new
> ListItem(strPlaceholderContent, strPlaceholderContent));
> }
> authoringContainer.Controls.Add(this._editDropDownList);
> }
> else
> {
> // code when _autoFill is false (show normal textbox)
> }
> }
>
> I just have to figure out how to switch between the textbox and de
> dropdownlist. If the dropdownlist is always visible instead of the
> textbox no new line can be entered.
>
> markcz wrote:
|
|
|
|
|