Posts Tagged ‘ajax toolkit’

Solving Calendar Extender Problem in Modal Popup Extender

September 13, 2010 3 comments

Calendar Extender control when placed inside modal popup extender will not be seen in front. To solve this issue, we have the following solution

<cc1:CalendarExtender ID="CalendarExtender1" TargetControlID="Textbox1"
 PopupPosition="Right" runat="server" <strong>OnClientShown="CalendarShown"></strong> </cc1:CalendarExtender>
function calendarShown(sender, args)
    { = 10005;

Textbox Watermark using Ajaxtoolkit or By Javascript

August 31, 2009 2 comments

Adding Watermark to textbox can be done in two ways:

1) Using Ajax Toolkit:

<asp:TextBox runat=”server” id=”txtname”/>

<ajaxToolkit:TextBoxWatermarkExtender ID="TBWE2" runat="server"
    WatermarkText="Type First Name Here"
    WatermarkCssClass="watermarked" />

For more information on Ajax Toolkit please visit:

2) Using Javascript:

<asp:TextBox ID=”txtname” runat=”server” Text = “Please Enter your Name here”
 onblur = “TextboxWaterMark(this, event);”
 onfocus = “TextboxWaterMark(this, event);”>

<script type = “text/javascript”>
 var Text = “Please Enter your text here”;//black

 function TextboxWaterMark(txtid, evnt)
 if(txtid.value.length == 0 && evnt.type == “blur”)
 { = “set the color you want”;//red
 txtid.value = Text;
 if(txtid.value == Text && evnt.type == “focus”)
 { = “set the color you want”;

To use in code behind :

 txtname.Attributes.Add(”onblur”, “TextboxWaterMark(this, event);”);

 txtname.Attributes.Add(”onfocus”, “TextboxWaterMark(this, event);”);