How to use ValidatorCalloutExtender in asp.net ajax


ValidatorCalloutExtender



ValidatorCalloutExtender is an asp.net ajax control toolkit's extender control. ValidatorCalloutExtender
control enhances the functionality of existing asp.net validators.




The following asp.net ajax example code demonstrate us how can we use ValidatorCalloutExtender control. in this code
we created a TextBox control and a RequiredFieldValidor control. the RequiredFieldValidator control ensure that
the TextBox is a required field in the web form. we places a ValidatorCalloutExtender control to enhance the
RequiredFieldValidator control. when someone submit the form without inputting TextBox value the ValidatorCalloutExtender
show the error message in callout that was defined by the RequiredFieldValidator ErrorMessage property.




ValidatorCalloutExtender control's have the following properties those are TargetControlID, Width, CssClass, HighlightCssClass,
WarningIconImageUrl, CloseImageUrl and Animations.




ValidatorCalloutExtender control's TargetControlID property specify the asp.net validation server control that we want to extend.
Width property set the callout width.

WarningIconImageUrl property allow us to use a custom image icon for warning and CloseImageUrl allow to set a
custom close image.




Animations property allow us to apply generic animations for ValidatorCalloutExtender control. OnShow allow to play
animation each time the validation popup is displayed and OnHide allow to play animation each time the validation popup
is hidden.




asp.net developers can change the default design of ValidatorCalloutExtender's validation callout using CssClass and
HighlightCssClass property. HighlightCssClass property allow us to apply css style to invalid field.





UsingValidatorCalloutExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "You submitted name: " + TextBox1.Text;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Ajax ValidatorCalloutExtender - How to use ValidatorCalloutExtender in asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:Green; font-style:italic;">Ajax Control Toolkit Example: Using ValidatorCalloutExtender</h2>
<hr width="575" align="left" color="LawnGreen" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:ValidatorCalloutExtender
ID="ValidatorCalloutExtender1"
runat="server"
TargetControlID="RequiredFieldValidator1"
>
</cc1:ValidatorCalloutExtender>
<asp:Label
ID="Label1"
runat="server"
ForeColor="Salmon"
Font-Size="Large"
Font-Names="Comic Sans MS"
>
</asp:Label>
<br /><br />
<asp:Label
ID="Label2"
runat="server"
Text="Name"
Font-Bold="true"
ForeColor="DeepPink"
>
</asp:Label>
<asp:TextBox
ID="TextBox1"
runat="server"
>
</asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1"
runat="server"
ControlToValidate="TextBox1"
ErrorMessage="Input your name!"
Display="None"
>
</asp:RequiredFieldValidator>
<br /><br />
<asp:Button
ID="Button1"
runat="server"
Text="Submit Name"
Height="40"
Font-Bold="true"
ForeColor="DeepPink"
OnClick="Button1_Click"
/>
</div>
</form>
</body>
</html>
















How to use SliderExtender in asp.net ajax


SliderExtender in asp.net ajax



SliderExtender is an asp.net ajax control toolkit's extender control. SliderExtender control allow asp.net developers
to upgrade a TextBox server control to a graphical slider. The slider provide a way to users to choose a numeric value
from a finite range.




When someone choose a value using the slider, it is automatically persisted during full or partial postbacks. asp.net
developers can continue to reference the TextBox to get and set the slider's value. A typical slider have three parts
those are a rail, a handle and a TextBox or label to show the slider's current value.




SliderExtender control's have the following properties those are TargetControlID, BoundControlID, Minimum, Maximum, Decimals,
Steps, Value, EnableHandleAnimation, HandleAnimationDuration, RailCssClass, HandleCssClass, HandleImageURL, Length, RaiseChangeOnlyOnMouseUp
and TooltipText.




SliderExtender TargetControlID property specify a TextBox server control which we want to extend as a Slider. BoundControlID property
also specify a TextBox or a Label control to display slider's value. Length property specify the Width of a horizontal slider
or height of a vertical slider when default layout is used.




TooltipText property display a text as tooltip when the slider's handle is hovered. The {0} placeholder in the text is replaced
with the current value of slider.




Minimum property specify the minimum value allowed in slider and Maximum property set the maximum allowed value. Decimals property specify the number of
decimal digits for the value. Steps property specify the number of discrete values inside slider's range. Value property indicate the current value
of slider.




EnableHandleAnimation property allow us to enable or disable handle animation of slider. If handle animation is enabled we can set the
animation duration in milliseconds using HandleAnimationDuration property.




If we set the RaiseChangeOnlyOnMouseUp property value to true, it fires the change event on the extended TextBox only when the left mouse button
is released.




HandleCssClass and RailCssClass property help us to change the look and feel (design) of slider's rail and handle using css.





UsingSliderExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">
protected void LinkButton1_Click(object sender, EventArgs e)
{
int imageWidth = Convert.ToInt32(TextBox2.Text);
Image1.Width = 1 * imageWidth;
}

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>How to use SliderExtender in asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DarkSeaGreen; font-style:italic;">Ajax Control Toolkit Example: Using SliderExtender</h2>
<hr width="450" align="left" color="DarkSeaGreen" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:SliderExtender
ID="SliderExtender1"
runat="server"
TargetControlID="TextBox1"
BoundControlID="TextBox2"
Minimum="200"
Maximum="600"
>
</cc1:SliderExtender>
<br />
<table>
<tr>
<td>
<asp:TextBox
ID="TextBox1"
runat="server"
>
</asp:TextBox>
</td>
<td>
<asp:TextBox
ID="TextBox2"
runat="server"
ForeColor="Crimson"
Width="25"
>
</asp:TextBox>
</td>
<td>
<asp:LinkButton
ID="LinkButton1"
runat="server"
Text="Change Image Size"
ForeColor="DodgerBlue"
Font-Bold="true"
BorderColor="CornflowerBlue"
BorderWidth="1"
OnClick="LinkButton1_Click"
>
</asp:LinkButton>

</td>
</tr>
</table>
<br />
<asp:Image
ID="Image1"
runat="server"
ImageUrl="~/Images/Tiger.jpg"
Width="200"
/>
</div>
</form>
</body>
</html>

How to use TextBoxWatermarkExtender in asp.net ajax


TextBoxWatermarkExtender



TextBoxWatermarkExtender is an asp.net ajax control toolkit's extender control. TextBoxWatermarkExtender control can be
attached to an asp.net TextBox web server control. TextBoxWatermarkExtender control apply watermark behavior on target
TextBox server control.




When a watermarked textbox control is empty, it display a message in the text input area of the textbox with a custom css style.
if someone typed some text into the textbox control, the watermarked appearance goes away.




TextBoxWatermarkExtender control's properties are TargetControlID, WatermarkText and WatermarkCssClass.




TargetControlID property specify the TextBox server control which we want to extend for attach watermark behavior.
WatermarkText property set the message which we want to display in TextBox control when textbox has no value.
WatermarkCssClass represent a css class which we want to apply into the textbox control when textbox has no value.




Typically asp.net developers use a watermarked TextBox to display additional instruction to input text in TextBox without
wasting any space in web page.




The following asp.net ajax example source code demonstrates us how can we use TextBoxWatermarkExender control in web pages.





UsingTextBoxWatermarkExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Subscription Successful!";
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Ajax TextBoxWatermarkExtender - How to use TextBoxWatermarkExtender in asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DarkBlue; font-style:italic;">Ajax Control Toolkit Example: Using TextBoxWatermarkExtender</h2>
<hr width="550" align="left" color="LightBlue" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:TextBoxWatermarkExtender
ID="TexBoxWatermarkExtender1"
runat="server"
TargetControlID="TextBox1"
WatermarkText="Input your email"
>
</cc1:TextBoxWatermarkExtender>
<br />
<asp:Label
ID="Label1"
runat="server"
ForeColor="OrangeRed"
Font-Bold="true"
Font-Size="Large"
>
</asp:Label>
<br /><br />
<asp:TextBox
ID="TextBox1"
runat="server"
ForeColor="SeaGreen"
>
</asp:TextBox>
<asp:Button
ID="Button1"
runat="server"
Text="Subscribe RSS Feed"
OnClick="Button1_Click"
Height="30"
Font-Bold="true"
ForeColor="Green"
/>
</div>
</form>
</body>
</html>
















How to use Accordion in asp.net ajax


Accordion and AccordionPane in asp.net ajax



Accordion is an asp.net ajax toolkit's control. Accordion web control provide multiple panes.
only one pane can display at a time in an Accordion control. Accordion is implemented as a web control.
an AccordionPane web control represent a pane in accordion. AccordionPane control built with a header template and
a content template. asp.net developers can track the selected pane so it stays visible across postback.




Accordion control support three auto size modes those are None, Limit and Fill. we can set Accordion auto
size mode by setting a value for its AutoSize property. AutoSize mode None allow the Accordion
grows or shrink without restriction. with this property Accordion size depends on pane content size. AutoSize mode Limit
set a maximum height for Accordion control. in this mode, if the pane content is higher than Accordion Height property then a scrollbar
appears in Accordion control. Fill mode stays the Accordion exacts same size as its Height property.




Accordion control can be data bound. we just need to specify Accordion control's DataSource or DataSourceID property.
after assigning property value we need to set data items in HeaderTemplate and ContentTemplate property. if we use Accordion
DataSource property then we must need to call the DataBind method.




Accordion control also have many useful properties such as SelectedIndex, HeaderCssClass, HeaderSelectedCssClass, ContentCssClass,
FadeTransitions, TransitionDuration, FramesPerSecond, RequireOpenedPane, SupressHeaderPostbacks, Panes, HeaderTemplate, ContentTemplate etc.




Accordion SelectedIndex property indicate the AccordionPane that is initially visible.




HeaderCssClass, HeaderSelectedCssClass, ContentCssClass properties are used to change the default look and feel of Accordion and AccordionPane
controls.




FadeTransition, TransitionDuration and FramesPerSecond properties allow us to configure Accordion fading transition effect.

RequireOpenedPane property ensure that one pane is always open (visible) in Accordion control. SupressHeaderPostbacks property prevent
client side click handlers for pane header elements such as a hyperlink in header. Panes property provide a collection of AccordionPane
controls in Accordion.




HeaderTemplate contains the markup which is used for a pane's header when databinding and ContentTemplate contains the markup for pane's content
when databinding.




UsingAccordion.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>How to use Accordion in asp.net ajax</title>
<style type="text/css">
.HeaderCSS
{
color:Snow;
background-color:Crimson;
font-size:medium;
border:solid 1px salmon;
font-weight:bold;
}
.HeaderSelectedCSS
{
color:Snow;
background-color:OrangeRed;
font-weight:bold;
font-style:italic;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DarkSeaGreen; font-style:italic;">Ajax Control Toolkit Example: Using Accordion</h2>
<hr width="450" align="left" color="DarkSeaGreen" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:Accordion
runat="server"
ID="Accordion1"
HeaderCssClass="HeaderCSS"
HeaderSelectedCssClass="HeaderSelectedCSS"
Width="500"
BorderColor="Orange"
BorderWidth="2"
>
<Panes>
<cc1:AccordionPane runat="server" ID="AccordionPane1">
<Header>Red Orchid</Header>
<Content>
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/RedOrchid.jpg" Width="200" />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane2">
<Header>Green Orchid</Header>
<Content>
<asp:Image ID="Image2" runat="server" ImageUrl="~/Images/GreenOrchid.jpg" />
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane runat="server" ID="AccordionPane3">
<Header>Blue Orchid</Header>
<Content>
<asp:Image ID="Image3" runat="server" ImageUrl="~/Images/BlueOrchid.jpg" />
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>
</div>
</form>
</body>
</html>












How to use RoundedCornersExtender in asp.net ajax


RoundedCornersExtender in asp.net ajax



RoundedCornersExtender is an asp.net ajax control toolkit's extender control. RoundedCornersExtender allow
us to apply rounded corners to an element such as Panel, BulletedList, CheckBoxList, RadioButtonList server controls.
to apply rounder corners, RoundedCornersExtender control insert elements before and after the target element, so the overall
height of the target element will change slightly.




RoundedCornersExtender control's have the following properties those are TargetControlID, Radius, Corners, Color and BorderColor.




RoundedCornersExtender control's TargetControlID property specify the control which corners we want to make rounded. Corners property
specify the corners of the target control that should be rounded. Corners enumeration have the following values those are None, TopLeft, TopRight,
BottomRight, BottomLeft, Top, Right, Bottom, Left and All. so we can round any corner of target control or all corners.
Radius property set the radius of target control's corners and height of the added area. Radius property default value is 5.




Color property get or set a background color of rounded corner areas in target control. BorderColor property get or set a border color and therefore
of the rounded corners.




RoundedCornersExtender control's have the following methods those are initialize(), dipose(), update(), disposeParentDiv(), getBackgroundColor(),
moveChildren(), isCornerSet(corner) and setCorner(corner, value).




RoundedCornersExtender isCornerSet(corner) method allow us to check whether the specified corner has been set. setCorner(corner, value) method
allow us to set a corner that should be rounded. getBackgroundColor() method provide a way to get the target element's background color.





UsingRoundedCornersExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>How to use RoundedCornersExtender in asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DarkSeaGreen; font-style:italic;">Ajax Control Toolkit Example: Using RoundedCornersExtender</h2>
<hr width="600" align="left" color="DarkSeaGreen" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:RoundedCornersExtender
ID="RoundedCornersExtender1"
runat="server"
TargetControlID="CheckBoxList1"
Radius="20"
>
</cc1:RoundedCornersExtender>
<br /><br />
<asp:CheckBoxList
ID="CheckBoxList1"
runat="server"
BackColor="OrangeRed"
ForeColor="Snow"
RepeatColumns="3"
Width="450"
Font-Names="Comic Sans MS"
Font-Size="Large"
>
<asp:ListItem>OrangeRed</asp:ListItem>
<asp:ListItem>BurlyWood</asp:ListItem>
<asp:ListItem>SaddleBrown</asp:ListItem>
<asp:ListItem>RosyBrown</asp:ListItem>
<asp:ListItem>Maroon</asp:ListItem>
<asp:ListItem>SeaGreen</asp:ListItem>
<asp:ListItem>DarkBlue</asp:ListItem>
</asp:CheckBoxList>
</div>
</form>
</body>
</html>




How to use NumericUpDownExtender in asp.net ajax


NumericUpDownExtender in asp.net ajax



NumericUpDownExtender is an asp.net ajax control toolkit's extender control. NumericUpDownExtender control
can be extend and attached to an asp.net TextBox server control. target textbox control add a Up and a Down button
that increment and decrement the value in the textbox. the increment and decrement can be simple +1/-1 arithmetic.




NumericUpDownExtender control have the following properties those are TargetControlID, TargetButtonUpID, TargetButtonDownID,
Width, RefValues, Step, Minimum, Maximum, Tag, ServiceUpPath, ServiceUpMethod, ServiceDownPath and ServiceDownMethod.




NumericUpDownExtender control's TargetControlID property specify the TextBox server control which we want to extend as a
NumericUpDown control. Width property set the combined size of TextBox and Up/Down buttons. Width property minimum value is 25.




Minimum property set the minimum allowed value for the extender control and Maximum property set the maximum allowed value.
Step property get or set a number that specifies the step value used for simple numeric incrementing and decrementing.




RefValues property get or set a string which contains a list of strings separated by semicolons to be used as an enumeration.
this property allow us to cycle through a provided list of values such as the months of the year.




TargetButtonUpID and TargetButtonDownID properties allow us to use custom images instead of default Up and Down button graphics.




ServiceUpPath, ServiceUpMethod, ServiceDownPath, ServiceDownMethod and Tag properties allow us to integrate a NumericUpDownExtender control
with Web service.




NumericUpDownExtender control's have the following methods those are initialize(), dipose(), raiseCurrentChanged(Sys.EventArgs), readValue()
and setCurrentToTextBox(value).




NumericUpDownExtender control's raiseCurrentChanged(Sys.EventArgs) method raises the currentChanged event. a Sys.EventArgs object represent
event arguments for the currentChanged event. readValue() method allow us to read the value of associated textbox. setCurrentToTextBox(value)
method set the associated textbox value.




NumericUpDownExtender control provide an event named currentChanged(handler). it allow us to add or remove an event handler
for the currentChanged event. the Parameter used here is a function representing the event handler.





UsingNumericUpDownExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
int number =Convert.ToInt32(TextBox1.Text);
Image1.Width = 50 * number;
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>How to use NumericUpDownExtender in asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DodgerBlue; font-style:italic;">Ajax Control Toolkit Example: Using NumericUpDownExtender</h2>
<hr width="600" align="left" color="LightBlue" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:NumericUpDownExtender
ID="NumericUpDownExtender1"
runat="server"
TargetControlID="TextBox1"
Minimum="1"
Maximum="25"
Width="100"
>
</cc1:NumericUpDownExtender>
<asp:Label
ID="Label1"
runat="server"
Text="Multiply original Image Size"
Font-Bold="true"
ForeColor="Crimson"
>
</asp:Label>
<asp:TextBox
ID="TextBox1"
runat="server"
Font-Bold="true"
ForeColor="Crimson"
BackColor="LightGoldenrodYellow"
>
</asp:TextBox>
<asp:Button
ID="Button1"
runat="server"
Text="Resize Image"
Font-Bold="true"
OnClick="Button1_Click"
ForeColor="Crimson"
Height="30"
/>
<br /><br />
<asp:Image
ID="Image1"
runat="server"
ImageUrl="~/Images/RedTree.jpg"
Width="50"
/>
</div>
</form>
</body>
</html>












How to use ListSearchExtender in asp.net ajax


ListSearchExtender



ListSearchExtender is an asp.net ajax control toolkit's extender control. ListSearchExtender control can be extend asp.net
ListBox and DropDownList web server controls. ListSearchExtender control allow us to search for items in an extended ListBox or
DropDownList server control by typing. ListSearchExtender control provide an incremental search within the ListBox based on what has been
typed so far.




ListSearchExtender control have the following properties those are TargetControlID, PromptText, PromptCssClass, PromptPosition,
QueryPattern, IsSorted, QueryTimeout, Animations, OnShow, OnShowBehavior, OnHide, OnHideBehavior and raiseImmediateOnChange.




ListSearchExtender control's TargetControlID specify the asp.net ListBox or DropDownList control which we want to provide items
search facility. PromptText property set a message to display when the target control get focus. PromptCssClass allow us to design
prompt message using css style. PromptPosition property set the position of prompt message in target ListBox or DropDownList control.
PromptPosition property value can be Top or Bottom and default value is Top.




QueryPattern property specify how the typed characters should be used in the search query. default query pattern is StartsWith that means
results starts with the typed word. QueryPattern property another value is Contains.




QueryTimeout property indicate whether the search query should be reset after the timeout if no match is found. default value
is 0 that means no auto reset behavior. IsSorted property indicate if items added to the list are expected to be sorted.




Animations property allow us to apply generic animations for the ListSearchExtender. OnShow ensure animation will be played
each time the prompt is displayed and OnHide ensure animation will be played each time prompt message is hidden.




raiseImmediateOnChange property indicate whether an OnChange event should be fired as soon as the selected element is changed, when
the list loses focus or user hits enter.




ListSearchExtender control have the following methods those are initialize(), dipose(), OnShow() and OnHide(). OnShow()
method play the OnShow animation and OnHide() method play the OnHide animation.




UsingListSearchExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if(!Page.IsPostBack)
{
string[] colorList = Enum.GetNames(typeof(KnownColor));
ListBox1.DataSource = colorList;
ListBox1.DataBind();
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Ajax ListSearchExtender - How to use ListSearchExtender in asp.net ajax</title>
<style type="text/css">
.PromptCSS
{
color:DodgerBlue;
font-size:large;
font-style:italic;
font-weight:bold;
background-color:AliceBlue;
height:25px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:SeaGreen; font-style:italic;">Ajax Control Toolkit Example: Using ListSearchExtender</h2>
<hr width="550" align="left" color="LawnGreen" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:ListSearchExtender
ID="ListSearchExtender1"
runat="server"
TargetControlID="ListBox1"
PromptCssClass="PromptCSS"
>
</cc1:ListSearchExtender>
<br /><br />
<asp:ListBox
ID="ListBox1"
runat="server"
BackColor="Pink"
ForeColor="DeepPink"
Font-Size="Medium"
Font-Bold="true"
Height="250"
>
</asp:ListBox>
</div>
</form>
</body>
</html>
















How to use DragPanelExtender in asp.net ajax


DragPanelExtender



DragPanelExtender is an asp.net ajax control toolkit's extender control. DragPanelExtender control allow
asp.net developers to add draggability to thier controls. DragPanelExtender control can be attached with asp.net Panel
server control. DragPanelExtender control attached with an additional control to use as the drag handle.




DragPanelExtender control have the two important properties those are TargetControlID and DragHandleID.
TargetControlID property specify the Panel server control which we want to make draggable. DragHandleID specify a control
which will serve as the drag handle for the target Panel control. when user clicks and drags DragHandleID property specified
control, the target Panel will move.




The following asp.net ajax example code demonstrate us how can we use DragPanelExtender to make a draggable panel.
we can use the target Panel control as a container for other controls those we want to make draggable. in this example
code we make an Image server control draggable by placing it inside draggable panel control. this is a simple tricks to make a control
draggable in asp.net application. we can move any control in a web page by using DragPanelExtender control. here we uses a Label
control as drag handle for draggable panel.




UsingDragPanelExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Ajax DragPanelExtender - How to use DragPanelExtender in asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DodgerBlue; font-style:italic;">Ajax Control Toolkit Example: Using DragPanelExtender</h2>
<hr width="600" align="left" color="LightBlue" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:DragPanelExtender
ID="DragPanelExtender1"
runat="server"
TargetControlID="Panel1"
DragHandleID="Label1"
>
</cc1:DragPanelExtender>
<asp:Panel
ID="Panel1"
runat="server"
BackColor="Snow"
Width="250"
HorizontalAlign="Center"
>
<asp:Label
ID="Label1"
runat="server"
Width="100%"
BackColor="HotPink"
Font-Bold="true"
ForeColor="Snow"
Text="Drag Me"
>
</asp:Label>
<asp:Image
ID="Image1"
runat="server"
ImageUrl="~/Images/RedFlower.jpg"
Height="275"
BorderWidth="3"
BorderColor="DeepPink"
/>
</asp:Panel>
</div>
</form>
</body>
</html>












How to use ConfirmButtonExtender in asp.net ajax


ConfirmButtonExtender in asp.net ajax



ConfirmButtonExtender is an asp.net ajax control toolkit's extender control. ConfirmButtonExtender
control catches clicks on a button or any instance of a type derived from button. after catching the clicks from
button instance ConfirmButtonExtender display a message to the user.




popup message box have three parts those are a question (message), an OK button and and a Cancel button. typically
popup message ask user that they really want to do the task or not. if they click the OK button from the popup message
box that ConfirmButtonExtender control generated then the button or link functions normally. if user click Cancel button from
message box then the click is trapped and the button will not not perform its default submit behavior.




ConfirmButtonExtender control's have the following built in properties those are TargetControlID, ConfirmText, OnClientCancel,
ConfirmOnFormSubmit and DisplayModalPopupID.




TargetControlID property specify the control (button or link) which need a confirmation before functions normally. ConfirmText property
set a question (text message) in confirm message box to ask user final decision.




OnClientCancel property allow us to execute a client side script when the Cancel button is clicked in confirm dialog. ConfirmOnFormSubmit
property ensure that confirm should be shown only after all asp.net validators pass. DisplayModalPopupID property optionally indicate a
ModalPopup control to use for displaying the confirmation dialog.




the following asp.net ajax c# example code demonstrate us how can we use ConfirmButtonExtender control. in this code we created a RadioButtonList
with items and a Button control. if an user select an item from radiobuttonlist and click the delete button then a confirm dialog appears on client browser.
if user click the OK button from confirm dialog box then selected item will be deleted from radiobuttonlist and if user click Cancel button
then radiobuttonlist item will not be deleted. a ConFirmButtonExtender control display the confirm dialog box when user click the delete button.





UsingConfirmButtonExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
RadioButtonList1.Items.Remove(RadioButtonList1.SelectedItem);
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>How to use ConfirmButtonExtender in asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DeepPink; font-style:italic;">Ajax Control Toolkit Example: Using ConfirmButtonExtender</h2>
<hr width="600" align="left" color="Pink" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:ConfirmButtonExtender
ID="ConfirmButtonExtender1"
runat="server"
TargetControlID="Button1"
ConfirmText="Are you sure you wanted to delete this color?"
>
</cc1:ConfirmButtonExtender>
<asp:RadioButtonList
ID="RadioButtonList1"
runat="server"
ForeColor="Snow"
BackColor="Crimson"
BorderColor="Orange"
BorderWidth="1"
RepeatColumns="2"
Width="500"
>
<asp:ListItem Selected="True">Crimson</asp:ListItem>
<asp:ListItem>LawnGreen</asp:ListItem>
<asp:ListItem>DeepPink</asp:ListItem>
<asp:ListItem>HotPink</asp:ListItem>
<asp:ListItem>LightPink</asp:ListItem>
<asp:ListItem>Salmon</asp:ListItem>
<asp:ListItem>DarkSeaGreen</asp:ListItem>
</asp:RadioButtonList>
<br />
<asp:Button
ID="Button1"
runat="server"
Text="Delete Selected Color"
Font-Bold="true"
ForeColor="DodgerBlue"
Height="40"
OnClick="Button1_Click"
/>
</div>
</form>
</body>
</html>












How to use CollapsiblePanelExtender in asp.net ajax


CollapsiblePanelExtender in asp.net ajax



CollapsiblePanelExtender is an asp.net ajax control toolkit's extender control. CollapsiblePanelExtender allow
us to create a collapsible section in asp.net web page. CollapsiblePanelExtender targets any Panel server control.
the panel is postback aware. on a client postback it can automatically restores its client states.




CollapsiblePanelExtender control have the following properties those are, TargetControlID, CollapsedSize, ExpandedSize,
Collapsed, AutoCollapse, AutoExpand, ScrollContents, ExpandControlID, CollapseControlID, TextLabelID, CollapsedText, ExpandedText,
ImageControlID, CollapsedImage, ExpandedImage and ExpandDirection.




CollapsiblePanelExtender control's TargetControlID property specify the Panel which we want to expand and collapse.
ExpandControlID specify the control that will expand target panel on a click. and CollapseControlID specify the control
that will collapse target panel on a click. if ExpandControlID and CollapseControlID is same control's ID then the control
will automatically toggle its state on each click.




CollapsedSize property specify the target panel's collapsed state size and ExpandedSize property set the target panel's
expand state size.




Collapsed property specify the target panel should initially be collapsed or expanded. AutoCollapse property allow us to automatically
collapse target panel when the mouse is moved off. and AutoExpand property allow us to automatically expand panel when mouse is
moved over. ScrollContents property allow us to add a scrollbar if the content is longer than panel itself.




TextLabelID property specify a Label control where the Status Text for the Panel will be placed. CollapsedText property show
a message on specified Label when Panel is collapsed and ExpandedText property show a message when the Panel is opened.




ImageControlID, ExpandedImage and CollapsedImage property allow us to set image icon to indicate Panel expand and collapse state.




ExpandDirection property have two possible values those are Vertical and Horizontal. Vertical value specify Panel will expands from top to bottom and
Horizontal value specify Panel will expands from left to right direction.




UsingCollapsiblePanelExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>How to use CollapsiblePanelExtender in asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DeepPink; font-style:italic;">Ajax Control Toolkit Example: Using CollapsiblePanelExtender</h2>
<hr width="600" align="left" color="Pink" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:CollapsiblePanelExtender
ID="CollapsiblePanelExtender1"
runat="server"
TargetControlID="Panel2"
ExpandControlID="Panel1"
CollapseControlID="Panel1"
TextLabelID="Label1"
ExpandedText="-"
CollapsedText="+"
>
</cc1:CollapsiblePanelExtender>
<asp:Label
ID="Label1"
runat="server"
ForeColor="Crimson"
Font-Italic="true"
Font-Names="Comic Sans MS"
Font-Size="XX-Large"
>
</asp:Label>
<asp:Panel
ID="Panel1"
runat="server"
Width="500"
>
<asp:Image
ID="Image1"
runat="server"
ImageUrl="~/Images/SeaBeach.jpg"
Height="150"
BorderWidth="1"
BorderColor="DarkSeaGreen"
/>
</asp:Panel>
<asp:Panel
ID="Panel2"
runat="server"
Width="500"
>
<asp:Image
ID="Image2"
runat="server"
ImageUrl="~/Images/SeaBeach.jpg"
BorderColor="DarkBlue"
BorderWidth="2"
/>
</asp:Panel>
</div>
</form>
</body>
</html>












How to use CalendarExtender in asp.net ajax


CalendarExtender in asp.net ajax



CalendarExtender is an asp.net ajax toolkit extender control. CalendarExtender can be attached to
be any asp.net TextBox web server control. CalendarExtender allow us to client side date picking functionality.
this calendar control provide us a customizable date format and user interface. user can click any day from calendar
to select a date or simply can click the today date link to select the current date.




calendar left and right arrows allow us to navigate between months. calendar title link provide us a way to
change the view of calendar such as days in the current month, months in current year, years in the current decade.
this feature is great to quickly jump any date in the past or future in calendar.




CalendarExtender control have the following built in properties those are TargetControlID, CssClass, Format, PopupButtonID,
PopupPosition, SelectedDate, StartDate and EndDate.




CalendarExtender TargetControlID property value specify the TextBox server control which we want to extend as an ajax calendar control.
Format property allow us to apply various date formatting to display calendar selected date.




we can use an Image server control to display as a calendar icon near TextBox. we just need to set the PopupButtonID property value
to that Image control ID. when user click the image, then the calendar will pop up. if we does not set PopupButtonID property value then
calendar will pop up only when TextBox control receive focus.




CalendarExtender SelectedDate property value indicate calendar initializing date. StartDate and EndDate property specify the available
start and end range of date selection.




CalendarExtender have a default css collection. but we can customize the default look and feel of calendarExtender using its CssClass
property. this property override the default css style of CalendarExtender.




CalendarExtender have many css classes that we can customize such as ajax__calendar_container, ajax__calendar_header,
ajax__calendar_title, ajax_calendar_body, ajax__calendar_days, ajax__calendar_dayname, ajax_calendar_months, ajax__calendar_years,
ajax__calendar_today, ajax__calendar_hover, ajax_calendar_active etc.




those css classes can override the calendar default hover effect, title styles, day names styles, year design, month names look and feel and
many more.





UsingCalendarExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Drawing" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
TextBox1.ForeColor = Color.LightGoldenrodYellow;
TextBox1.ForeColor = Color.DeepPink;
TextBox1.Font.Bold = true;
TextBox1.Font.Size = FontUnit.Medium;
TextBox1.Font.Name = "Comic Sans MS";
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>How to use CalendarExtender in asp.net ajax</title>
<style type="text/css">
.CalendarCSS
{
background-color:OrangeRed;
color:Snow;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DarkBlue; font-style:italic;">Ajax Control Toolkit Example: Using CalendarExtender</h2>
<hr width="500" align="left" color="CornFlowerBlue" />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:CalendarExtender
ID="CalendarExtender1"
runat="server"
TargetControlID="TextBox1"
CssClass="CalendarCSS"
>
</cc1:CalendarExtender>
<asp:Label
ID="Label1"
runat="server"
ForeColor="DodgerBlue"
Font-Italic="true"
Font-Names="Comic Sans MS"
Font-Size="Large"
Text="Arrival Date: "
Font-Underline="true"
>
</asp:Label>
<asp:TextBox
ID="TextBox1"
runat="server"
>
</asp:TextBox>
</div>
</form>
</body>
</html>












How to use TabContainer in asp.net ajax


TabContainer and TabPanel



TabContainer is an asp.net ajax control. TabContainer contain TabPanel objects.
each TabPanel object represents a tab in TabContainer control. Tabs are used to organize the contents of TabContainer.
this is a very useful tool when asp.net developers want to organize their page content in a small area.




TabPanel object have two parts a Header and a Content area. tabs header can be define by HeaderText or HeaderTemplate.
ContentTemplate define the tabs content which we want to display in tab.




TabContainer have a great accessibility feature that we can access TabContainer by keyboard. we can navigate
to different tabs by using keyboard left and right arrow keys. vertically displayed tabs can be navigate
using keyboard up and down arrow keys.




TabContainer have many built in properties such as ActiveTabIndex, Height, ScrollBars, TabStripPlacement,
UseVerticalStripPlacement, VerticalStripWidth, AutoPostBack, OnDemand, CssClass, OnClientActiveTabChanged etc.




TabContainer ActiveTabIndex property set the first tab to show. ScrollBars property define whether to display scrollbars
in the TabContainer body. AutoPostBack property allow auto postback from the javascript when tab index changes. OnDemand
property define whether to render (load) tabs on demand or all at page load. CssClass property allow us to change the look and
feel of tabs. this property override the default style and design of tabs.




TabContainer ActiveTabChanged event fired on server side when a tab is changed after a postback.




TabPanel also have many built in properties such as Enabled, HeaderText, HeaderTemplate, ContentTemplate, ScrollBars, OnDemandMode, OnClientClick etc.





UsingTabContainer.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Image1.ImageUrl = "~/Images/RedFlower.jpg";
Image2.ImageUrl = "~/Images/Sky.jpg";
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>How to use TabContainer in asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DarkBlue; font-style:italic;">Ajax Control Toolkit Example: Using TabContainer</h2>
<hr width="500" align="left" color="CornFlowerBlue" />
<br /><br />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:TabContainer ID="TabContainer1" runat="server" Width="600">
<cc1:TabPanel ID="TabPanel1" runat="server">
<HeaderTemplate>
Red Flower
</HeaderTemplate>
<ContentTemplate>
<asp:Image ID="Image1" runat="server" />
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel2" runat="server">
<HeaderTemplate>
Color List
</HeaderTemplate>
<ContentTemplate>
<asp:CheckBoxList
ID="CheckBoxList1"
runat="server"
BorderColor="DeepPink"
ForeColor="Snow"
BackColor="Crimson"
BorderWidth="1"
RepeatColumns="2"
Width="500"
>
<asp:ListItem>Crimson</asp:ListItem>
<asp:ListItem>RosyBrown</asp:ListItem>
<asp:ListItem>DodgerBlue</asp:ListItem>
<asp:ListItem>Salmon</asp:ListItem>
<asp:ListItem>DeepPink</asp:ListItem>
<asp:ListItem>HotPink</asp:ListItem>
<asp:ListItem>Violet</asp:ListItem>
</asp:CheckBoxList>
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel3" runat="server">
<HeaderTemplate>
Sky Image
</HeaderTemplate>
<ContentTemplate>
<asp:Image ID="Image2" runat="server" />
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
</div>
</form>
</body>
</html>












How to use PagingBulletedListExtender in asp.net ajax


PagingBulletedListExtender in asp.net ajax



PagingBulletedListExtender is an asp.net ajax control toolkit's extender control. PagingBulletedListExtender control can
be attached to an asp.net BulletedList web server control and provide client side sorted paging.




PagingBulletedListExtender control have the following properties those are TargetControlID, ClientSort, IndexSize,
MaxItemPerPage, Separator, SelectIndexCssClass and UnselectIndexCssClass.




PagingBulletedListExtender control's TargetControlID property specify the BulletedList server control which we want to extend
as a sorted paging bulleted list. ClientSort property specify whether extended BulletedList control's items should be sorted
client side.




IndexSize property set the number of characters in the index headings should be appear in extended bulltedlist control. This
property is ignored if MaxItemPerPage property have a value. MaxItemPerPage property allow us to set maximum number of items
per page will display in extended BulletedList control. Separator property set the separator text between indices.




ASP.NET developers can change the default look and feel of extended BulltedList control using CSS classes. SelectIndexCssClass
represent a CSS class that we can apply for selected index design. UnselectIndexCssClass property apply a CSS class for
indices that are not selected.




UsingPagingBulletedListExtender.aspx



<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html>

<script runat="server">

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Ajax PagingBulletedListExtender - How to use PagingBulletedListExtender in asp.net ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color:DarkBlue; font-style:italic;">Ajax Control ToolKit Example: PagingBulletedListExtender</h2>
<hr width="575" align="left" color="CornFlowerBlue" />
<br /><br />
<asp:ScriptManager
ID="ScriptManager1"
runat="server"
>
</asp:ScriptManager>
<cc1:PagingBulletedListExtender
ID="PagingBulletedListExtender1"
runat="server"
TargetControlID="BulletedList1"
>
</cc1:PagingBulletedListExtender>
<asp:SqlDataSource
ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="Select ProductID, ProductName From Products"
>
</asp:SqlDataSource>
<asp:BulletedList
ID="BulletedList1"
runat="server"
DataSourceID="SqlDataSource1"
DataTextField="ProductName"
DataValueField="ProductID"
ForeColor="DodgerBlue"
>
</asp:BulletedList>
</div>
</form>
</body>
</html>