Is it possible to read placeholder content from within a custom placeholder ??
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Content Management Server > Is it possible to read placeholder content from within a custom placeholder ??




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Is it possible to read placeholder content from within a custom placeholder ??  
svdkooij


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-09-06 12:22 AM

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.






[ Post a follow-up to this message ]



    Re: Is it possible to read placeholder content from within a custom placeholder ??  
markcz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-10-06 12:19 AM

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.






[ Post a follow-up to this message ]



    Re: Is it possible to read placeholder content from within a custom placeholder ??  
svdkooij


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-10-06 12:20 PM

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
>






[ Post a follow-up to this message ]



    Re: Is it possible to read placeholder content from within a custom placeholder ??  
markcz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
12-11-06 12:21 PM

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: 






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:26 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register