Custom placeholder and postbacks
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 > Custom placeholder and postbacks




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

    Custom placeholder and postbacks  
A Louis


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


 
10-05-04 10:54 PM

I am trying to create a placeholder that will display a textbox, a button an
d
dropdownlist in authoring mode. When the user clicks the button, it brings u
p
a popup window with a list of postings. After the user selects a posting fro
m
the popup, the textbox in the placeholder is populated with the selected
posting's path. Now the template containing the placeholder fires a postback
.
So far everything works. My problem is when the postback happens, the textbo
x
contents dissappears. Is there anything special I have to do, to handle
postbacks in placeholder or template files? I noticed that when the postback
happens the URL changes from the CMS style to normal asp.net URL.

Any help is greatly appreciated.

Thanks,
Aby.

Here is the code:
protected override void  CreateAuthoringChildControls(BaseModeCon
tainer
authoringContainer)
{
this.tbPostingName = new TextBox();
this.tbPostingName.ID = "PostingName";
authoringContainer.Controls.Add(this.tbPostingName);
this.lbBrowse = new LinkButton();
this.lbBrowse.ID = "Browse";
this.lbBrowse.Text = "Select Page";
this.lbBrowse.Click += new EventHandler(lbBrowse_Click);
this.lbBrowse.Attributes.Add("onclick", "return CMS_createLink('" +
tbPostingName.ClientID + "');");
authoringContainer.Controls.Add(this.lbBrowse);
authoringContainer.Controls.Add(new HtmlGenericControl("BR"));

this.dpPlaceholderList = new DropDownList();
this.dpPlaceholderList.ID = "PlaceHolderList";
authoringContainer.Controls.Add(this.dpPlaceholderList);
}

private void lbBrowse_Click(object sender, EventArgs e)
{
EnsureChildControls();
if (this.tbPostingName.Text != "") //<B>This is empty </B>
{
Posting selectedPosting =
(Posting)CmsHttpContext.Current.Searches.GetByPath(this.tbPostingName.Text);
if (selectedPosting != null)
{
foreach (Placeholder ph in selectedPosting.Placeholders)
{
this.dpPlaceholderList.Items.Add(ph.Name);
}
}
}
}






[ Post a follow-up to this message ]



    Re: Custom placeholder and postbacks  
Stefan [MSFT]


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


 
10-06-04 07:48 AM

Hi Aby,

this is more an ASP.NET problem than a MCMS problem.
It seems you need to repopulate the content for some reason.
Might be due to the sequence of the events being fired - a post on a ASP.NET
newsgroup might be more helpful.

What you could do is to repopulate the content from the Request.Form field
for the text box.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...>
MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...nagement+Server
MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"A Louis" <ALouis@discussions.microsoft.com> wrote in message
news:9200C3CA-2C91-4A91-9AC5-60154B3A80A4@microsoft.com...
> I am trying to create a placeholder that will display a textbox, a button
and
> dropdownlist in authoring mode. When the user clicks the button, it brings
up
> a popup window with a list of postings. After the user selects a posting
from
> the popup, the textbox in the placeholder is populated with the selected
> posting's path. Now the template containing the placeholder fires a
postback.
> So far everything works. My problem is when the postback happens, the
textbox
> contents dissappears. Is there anything special I have to do, to handle
> postbacks in placeholder or template files? I noticed that when the
postback
> happens the URL changes from the CMS style to normal asp.net URL.
>
> Any help is greatly appreciated.
>
> Thanks,
> Aby.
>
> Here is the code:
> protected override void  CreateAuthoringChildControls(BaseModeCon
tainer
> authoringContainer)
> {
> this.tbPostingName = new TextBox();
> this.tbPostingName.ID = "PostingName";
> authoringContainer.Controls.Add(this.tbPostingName);
> this.lbBrowse = new LinkButton();
> this.lbBrowse.ID = "Browse";
> this.lbBrowse.Text = "Select Page";
> this.lbBrowse.Click += new EventHandler(lbBrowse_Click);
> this.lbBrowse.Attributes.Add("onclick", "return CMS_createLink('" +
> tbPostingName.ClientID + "');");
> authoringContainer.Controls.Add(this.lbBrowse);
> authoringContainer.Controls.Add(new HtmlGenericControl("BR"));
>
> this.dpPlaceholderList = new DropDownList();
> this.dpPlaceholderList.ID = "PlaceHolderList";
> authoringContainer.Controls.Add(this.dpPlaceholderList);
> }
>
> private void lbBrowse_Click(object sender, EventArgs e)
> {
> EnsureChildControls();
> if (this.tbPostingName.Text != "") //<B>This is empty </B>
> {
> Posting selectedPosting =
>
(Posting)CmsHttpContext.Current.Searches.GetByPath(this.tbPostingName.Text);
> if (selectedPosting != null)
> {
> foreach (Placeholder ph in selectedPosting.Placeholders)
> {
> this.dpPlaceholderList.Items.Add(ph.Name);
> }
> }
> }
> }
>







[ Post a follow-up to this message ]



    Re: Custom placeholder and postbacks  
A Louis


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


 
10-07-04 04:20 PM

Stefan,

Now I got the placeholder working for the most part except one glitch. When
doing an authoringpreview my dropdownlist is still empty during the
SavePlaceholderContent() event. I am also calling the EnsureChildControls()
method within this method. But the same method SavePlaceholderContent() is
sucessful when saving the posting. Also I can preview the page when the page
is edit mode.

Is there anything else I have to do when dealing with asp.net controls?

Is there any sample code out there where a dropdownlist control is used in a
custom placeholder? Most the of the sample code out there uses html controls
instead of .net server controls.

Note: I am trying to create a RenderPlaceholder control like the one you
developed where the user can set the posting and placeholder name at
authoring time instead of the template design time. I have a textbox, a link
button and a dropdownlist control in my placeholder.

Your help is greatly appreciated.

Thanks,
Aby

"Stefan [MSFT]" wrote:

> Hi Aby,
>
> this is more an ASP.NET problem than a MCMS problem.
> It seems you need to repopulate the content for some reason.
> Might be due to the sequence of the events being fired - a post on a ASP.N
ET
> newsgroup might be more helpful.
>
> What you could do is to repopulate the content from the Request.Form field
> for the text box.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>
> MCMS FAQ:
> http://download.microsoft.com/downl...
a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
> http://www.gotdotnet.com/community/...nagement+Server
> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "A Louis" <ALouis@discussions.microsoft.com> wrote in message
> news:9200C3CA-2C91-4A91-9AC5-60154B3A80A4@microsoft.com... 
> and 
> up 
> from 
> postback. 
> textbox 
> postback 
> (Posting)CmsHttpContext.Current.Searches.GetByPath(this.tbPostingName.Text
); 
>
>
>





[ Post a follow-up to this message ]



    Re: Custom placeholder and postbacks  
Stefan [MSFT]


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


 
10-07-04 04:20 PM

Hi Aby,

I never tested my placeholder controls in  preview mode - so no idea if it
works or not.
Just try it:
http://www.gotdotnet.com/Community/...c8-e8feb9a1fbeb

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...>
MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...nagement+Server
MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"A Louis" <ALouis@discussions.microsoft.com> wrote in message
news:B17E0C4F-7B19-47A5-BB17-C620CDEA2E25@microsoft.com...
> Stefan,
>
> Now I got the placeholder working for the most part except one glitch.
When
> doing an authoringpreview my dropdownlist is still empty during the
> SavePlaceholderContent() event. I am also calling the
EnsureChildControls()
> method within this method. But the same method SavePlaceholderContent() is
> sucessful when saving the posting. Also I can preview the page when the
page
> is edit mode.
>
> Is there anything else I have to do when dealing with asp.net controls?
>
> Is there any sample code out there where a dropdownlist control is used in
a
> custom placeholder? Most the of the sample code out there uses html
controls
> instead of .net server controls.
>
> Note: I am trying to create a RenderPlaceholder control like the one you
> developed where the user can set the posting and placeholder name at
> authoring time instead of the template design time. I have a textbox, a
link[vbcol=seagreen]
> button and a dropdownlist control in my placeholder.
>
> Your help is greatly appreciated.
>
> Thanks,
> Aby
>
> "Stefan [MSFT]" wrote:
> 
ASP.NET[vbcol=seagreen] 
field[vbcol=seagreen] 
rights.[vbcol=seagreen] 
http://download.microsoft.com/downl...
+Server[vbcol=seagreen] 
button[vbcol=seagreen] 
brings[vbcol=seagreen] 
posting[vbcol=seagreen] 
selected[vbcol=seagreen] 
handle[vbcol=seagreen] 
(Posting)CmsHttpContext.Current.Searches.GetByPath(this.tbPostingName.Text);[vbcol=seagreen]
 







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:19 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