Creating a PopupControlExtender dynamically.

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
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top