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 ]
|