mobile ads

Thursday 14 November 2013

How to use Ajax calendar in ASP.NET


Step 1: Register ajax dll

Add this line after @Page directive.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtoolkit" %>

Step 2 : Include scriptmanager in your code
 <asp:ScriptManager ID="scrp" runat="server">    </asp:ScriptManager>

Step 3 : Next
<asp:TextBox ID="txtDOB" runat="server" />
                                                        <asp:Image ID="imgDOB" runat="server" Height="22px" ImageUrl="~/images/calendar.JPG"
                                                            Width="26px" />
                                                        <ajaxtoolkit:CalendarExtender ID="calDOB" runat="server" PopupButtonID="imgDOB" TargetControlID="txtDOB">
                                                        </ajaxtoolkit:CalendarExtender>

Ajax calendar control has two main properties, PopupButtonID and TargetControlID.

When we click on the image button a calendar will be shown and selected date will be displayed in textbox.

For this to work you need to add AjaxControlToolKit dll.

0 comments:

Post a Comment