SIGN UP MEMBER LOGIN:    
ARTICLE

BalloonPopupExtenderControl in AJAX

Posted by Davin Martyn Articles | AJAX in C# January 11, 2012
In this articles, I will discuss about the BalloonPopupExtenderControl which is used as a kind of a tooltip displayed when we are typing in a text field or on another event of the target control.
Reader Level:

Introduction 

AJAX (Asynchronous JavaScript and XML) is a new web development technique used for interactive websites. AJAX can help us develop web applications and retrieve small amounts of data from a web server. AJAX is a different type of technology.

  • JavaScript
  • XML
  • Asynchronous Call to the server
BalloonPopupExtender Control

The BalloonPopupExtender control provides 
support for vertical tabs, and support for keyboard tab navigation. The BalloonPopup extender allows a page to display content to the user in a "Balloon" manner which prevents the user from interacting with the rest of the page. The modal content can be any hierarchy of controls and is displayed above a background that can have a custom style applied to it.

BalloonPopupExtender control properties
  • TargetControlID : The ID of the control to which this extender is attache
  • BalloonPopupControlID : The ID of the control in which the content will be displayed, which is a Panel control
  • BalloonSize : It has three possible values: Large, Medium and Small
  • BalloonStyle : It has two possible values: Rectangle, Cloud and Custom
  • UseShadow : Whether we want to drop shadows with the BalloonPopup
Step 1 : Open Visual Studio 2010.
  • Go to File->New->WebSite
  • Select ASP.NET Empty WebSite
step1.gif

Step 2 : Go to Solution Explorer and right-click.
  • Select Add->New Item
  • Select WebForm
  • Default.aspx page open
step2.gif

Step 3 :  Go to Default.aspx page and click on the [Design] option and drag the control from the Toolbox.

  • Drag ScriptManager control, Panel, TextBox
Step 4 : Go to Default.aspx [Source] option and write the code.

Code :

<body bgcolor="#ff99cc">
    <form id="form1" runat="server" style="background-color: #5C5CA3">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div style="background-color: #659A69">
        <i style="background-color: #FFFFFF">Textbox</i> <asp:TextBox ID="TextBox1" Runat="server" />
        <asp:Panel ID="Panel1" runat="server" BackColor="#EB9894">
         <b>Hey
I am simple TextBox with BallonPopup</b>
            <br />
        </asp:Panel>
        <asp:BalloonPopupExtender ID="BalloonPopupExtender1" TargetControlID="TextBox1" BalloonPopupControlID="Panel1"  BalloonSize="Medium" 
            UseShadow="true" runat="server">
        </asp:BalloonPopupExtender>
    </div>
    </form
>
</body>
</
html>

BalloonPopupExtenderControl

Step 5 : Go to Default.aspx page and drag BalloonPopupExtenderControl from Toolbox.
  • Define the TargetControlID property and BalloonPopupControlID.
rec11.gif

Code :

<asp:BalloonPopupExtender ID="BalloonPopupExtender1" TargetControlID="TextBox1" BalloonPopupControlID="Panel1"  BalloonSize="Medium" 
            UseShadow="true" runat="server">
</
asp:BalloonPopupExtender
>


Define Balloon Style Property

Step 6 : The BalloonPopupControl has a BalloonStyleProperty which defines the shape and size.
  • Balloon Style property set Rectangle shape.

<asp:BalloonPopupExtender ID="BalloonPopupExtender1" TargetControlID="TextBox1" BalloonPopupControlID="Panel1"  BalloonSize="Medium" BalloonStyle ="Rectangle" UseShadow="true"runat="server">
 </asp:BalloonPopupExtender
>

Step 7 : Now run the application by pressing F5.

REC....gif

Step 8 :
If we change the BalloonStyle property to "Cloud" then show following shape.

rect1.gif

Step 9 :
The BalloonStyle property could be also define the "Custom" property, which means that we will  have a CSS class where we will put our definitions of the look of the BalloonPopupExtender.

  • Drag image control from Toolbox.

Step 10 :  Go to Default.aspx page and write a code.

Code : 

     <asp:Panel ID="Panel1" runat="server" BackColor="#EB9894">
         <b>Hey MY AJAX APPLICATION</b>
            <br />
        </asp:Panel>
        </div>
        <div>
        <asp:BalloonPopupExtender ID="BalloonPopupExtender1" TargetControlID="TextBox1" BalloonPopupControlID="Panel1"  BalloonSize="Medium" BalloonStyle="rectangle" UseShadow
="true" runat="server">
        </asp:BalloonPopupExtender>
        <br />
        <br />
        <br />
        <asp:Image ID="Image1" runat="server" ImageUrl="~/CSSiteLogo.gif" />
    <asp:Panel ID="Panel2" runat="server">
        my picture application with balloon popup
    </asp:Panel>
    <asp:BalloonPopupExtender ID="BalloonPopupExtende2" TargetControlID="Image1" BalloonPopupControlID="Panel2" BalloonSize="Medium" BalloonStyle="Cloud" UseShadow="true"
runat="server" DisplayOnMouseOver="True"/>
    </div
>

Step 11 : Now run the application by Pressing F5.

rec5.gif

The result of moving the mouse over a picture will be the following.

rec3.gif

Here are some related resources.

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Gauge for SharePoint
Become a Sponsor