Creating a PopupControlExtender dynamically.

  • Thread starter Thread starter ata
  • Start date Start date
A

ata

Hi,
I need to create a PopupControlExtender dynamically, and attach it to
a LinkButton. i.e., when the LinkButton is clicked, I would like to
display a given literal control to the user. So, I tried the following
code:

LinkButton link = new LinkButton();
link.ID = "imgOtherAttributes" + caid;
link.CausesValidation = false;
link.Text = "other options";

LiteralControl lit2 = new LiteralControl();
lit2.ID = "popupWnd" + caid;
lit2.Text = "<div style='display:none;width:200px;height:
200px;background-color:red;'>test</div>";

AjaxControlToolkit.PopupControlExtender popup = new
AjaxControlToolkit.PopupControlExtender();
popup.ID = "popup" + caid;
popup.TargetControlID = link.ID;
popup.PopupControlID = lit2.ID;
popup.Position = AjaxControlToolkit.PopupControlPopupPosition.Right;

However, the LiteralControl isn't shown!

Any idea?

Thanks
Jack
 
did you add the new controls to the page? just creating a control will
not cause cause it to render, you must add to the page control
collection, or the collection of some container (the placeholder was
designed for this).

-- bruce (sqlwork.com)
 
Back
Top