Sunday, August 7, 2011

Displaying a simple PopUp Calendar in AJAX

To create a simple popup calendar we need too add following:
(1) Add a ToolkitScriptManager
(2) Add a TextBox control
(3) Add an CalendarExtender


(1) Add a ToolkitScriptManager
Before you can use any of the Ajax Control Toolkit controls in a page, you first need to add a ToolkitScriptManager to the page. You can drag the ToolkitScriptManager from the Visual Studio Toolbox window onto the page. The ToolkitScriptManager is located in the Ajax Control Toolkit tab under the Toolbox.


<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
(2) Add a TextBox control
The CalendarExtender works with a standard ASP.NET TextBox control. In Design view, drag a TextBox control from under the Standard tab in the Toolbox onto your page.

Next, change the ID of the TextBox control to txtStartDt. You can change the ID in the Properties window. The resulting source code looks like this:

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">

</asp:ToolkitScriptManager>
<asp:TextBox ID="txtStartDt" runat="server" Width="100" ontextchanged="txtStartDt_TextChanged"></asp:TextBox

(3) Add an CalendarExtender

The next step is to apply a CalendarExtender control to the TextBox. Add the following CalendarExtender control to your page:

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">

</asp:ToolkitScriptManager>


<asp:TextBox ID="txtStartDt" runat="server" Width="100"
ontextchanged="txtStartDt_TextChanged"></asp:TextBox>


<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtStartDt"

No comments:

Post a Comment

If you’re using Visual Studio to build your .NET MAUI app on a Mac, locating the IPA (iOS App Package) file can be a bit tricky

  If you’re using   Visual Studio   to build your   .NET MAUI   app on a   Mac , locating the   IPA (iOS App Package)   file can be a bit tr...