Creating a PopupControlExtender dynamically.

Discussion in 'ASP .Net' started by ata@mailinator.com, Jun 6, 2008.

  1. Guest

    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
     
    , Jun 6, 2008
    #1
    1. Advertising

  2. bruce barker Guest

    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)

    wrote:
    > 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
     
    bruce barker, Jun 6, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmV6YSBOYWJp?=

    Load User Control Dynamically, Cast object dynamically

    =?Utf-8?B?UmV6YSBOYWJp?=, Mar 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    6,733
    Matt Berther
    Mar 5, 2005
  2. jobs
    Replies:
    1
    Views:
    4,672
  3. =?Utf-8?B?QVNQIERldmVsb3Blcg==?=

    Use Image instead of text box wih the PopupControlExtender

    =?Utf-8?B?QVNQIERldmVsb3Blcg==?=, Dec 4, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    2,380
    =?Utf-8?B?QVNQIERldmVsb3Blcg==?=
    Dec 6, 2006
  4. mazdotnet
    Replies:
    1
    Views:
    3,969
  5. john

    Ajax PopupControlExtender

    john, Dec 24, 2007, in forum: ASP .Net Web Controls
    Replies:
    6
    Views:
    788
Loading...

Share This Page