469,602 Members | 1,961 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Ajax Control Toolkit - ModalPopupExtender

SD
Hi,
I have to use the ModalPopupExtender prgrammatically..
But the next sample doesn't work:
**************************
protected Button bt;
protected Button bc;
protected Button b;
protected Panel p;
protected Label lb;
protected UpdatePanel up;
protected AjaxControlToolkit.ModalPopupExtender mpe;

protected override void CreateChildControls()
{
base.CreateChildControls();

up = new UpdatePanel();
up.ID = "UpdatePanelTest";
up.ChildrenAsTriggers = false;
up.UpdateMode = UpdatePanelUpdateMode.Conditional;
this.Controls.Add(up);

bt = new Button();
bt.Text = "Cliquez Ici";
bt.ID = "btModalWindow";
up.ContentTemplateContainer.Controls.Add(bt);

p = new Panel();
p.ID = "Panel_Test";
p.Style.Add("DISPLAY", "none");
p.CssClass = "modalPopup";
p.Controls.Add(new LiteralControl("Cliquez sur OK!<br>"));

b = new Button();
b.ID = "OkButton";
b.Text = "OK";
p.Controls.Add(b);

bc = new Button();
bc.ID = "CancelButton";
bc.Text = "Annuler";
p.Controls.Add(bc);
up.ContentTemplateContainer.Controls.Add(p);

mpe = new AjaxControlToolkit.ModalPopupExtender();
mpe.ID = "modal_popup_control";
mpe.PopupControlID = p.ID;
mpe.TargetControlID = bt.ID;
mpe.BackgroundCssClass = "modalBackground";
mpe.DropShadow = true;
mpe.OkControlID = b.ID;
mpe.CancelControlID = bc.ID;
mpe.OnCancelScript = "alert('cancel');";
mpe.OnOkScript = "alert('OK');";
mpe.X = 300;
mpe.Y = 300;
up.ContentTemplateContainer.Controls.Add(mpe);

}

/// <summary>
/// Render this Web Part to the output parameter specified.
/// </summary>
/// <param name="output"The HTML writer to write out to </param>
protected override void RenderWebPart(HtmlTextWriter output)
{
this.EnsureChildControls();
up.RenderControl(output);
}
**************************
Do you see errors?
Any suggestions ?
Thanks
SD

May 3 '07 #1
0 3754

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Not Me | last post: by
2 posts views Thread by =?Utf-8?B?c3Jpbml2YXM=?= | last post: by
3 posts views Thread by =?Utf-8?B?UnlhbiBTbWl0aA==?= | last post: by
1 post views Thread by mistryman06 | last post: by
3 posts views Thread by Bobby Edward | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.