这是我的代码:
protected void Page_Load(object sender, EventArgs e)
{
Button btn = new Button();
btn.Text = "Button";
btn.ID = "Button1";
pnlMain.Controls.Add(btn);
Panel pnl = new Panel();
pnl.ID = "pnl";
Label lbl = new Label();
lbl.ID = "lbl";
lbl.Text = "Hi this is my Balloon popup";
pnl.Controls.Add(lbl);
pnlMain.Controls.Add(pnl);
BalloonPopupExtender balloonPopupExtender1= new BalloonPopupExtender();
balloonPopupExtender1.TargetControlID = btn.ID;
balloonPopupExtender1.BalloonPopupControlID = pnl.ID;
balloonPopupExtender1.BalloonSize = BalloonPopupSize.Small;
balloonPopupExtender1.BalloonStyle = BalloonPopupStyle.Rectangle;
balloonPopupExtender1.DisplayOnMouseOver = true;
balloonPopupExtender1.DisplayOnClick = true;
balloonPopupExtender1.DisplayOnFocus = false;
}
此代码正确执行但气球弹出窗口未显示...
答案 0 :(得分:0)
我有解决方案
Panel pnlBalloon = new Panel();
pnlBalloon.ID="pnlBalloon";
Label LblBalloon = new Label();
LblBalloon.ID="LblBalloon";
pnlBalloon.Controls.Add(LblBalloon);
pnl_Message.Controls.Add(pnlBalloon);
LblBalloon.Text = "This is Balloon Popup";
AjaxControlToolkit.BalloonPopupExtender BalloonPopupExtender1 = new AjaxControlToolkit.BalloonPopupExtender();
BalloonPopupExtender1.ID = "BalloonPopupExtender1";
BalloonPopupExtender1.TargetControlID = labelShow.ID;
BalloonPopupExtender1.BalloonPopupControlID = pnlBalloon.ID;
BalloonPopupExtender1.BalloonSize = AjaxControlToolkit.BalloonPopupSize.Small;
BalloonPopupExtender1.BalloonStyle = AjaxControlToolkit.BalloonPopupStyle.Rectangle;
BalloonPopupExtender1.Position = AjaxControlToolkit.BalloonPopupPosition.BottomRight;
BalloonPopupExtender1.DisplayOnClick = false;
BalloonPopupExtender1.DisplayOnMouseOver = true;
BalloonPopupExtender1.DisplayOnFocus = false;
pnlConnection.Controls.Add(BalloonPopupExtender1);