I once had a problem with this extender back then. I've searched for the answer long and hard and never found it. The search results showed me that I was better off using the ASP.NET calendar with a PopupExtender, because there was no way that the SelectedDate in the CalendarExtender could be retrieved by the server, it stays on the client side.

As I looked at the AjaxControlToolkit sample site (this comes along with the AjaxControlToolkit download), I immediately saw one mistake I committed. I should have used ToolkitScriptManager instead of ScriptManager. This then fixes my RoundedCornersExtender problem, it wrongly displayed the rounded corners back then.

Here's a sample markup:

<%@ Register Assembly='AjaxControlToolkit' Namespace='AjaxControlToolkit' TagPrefix='asp' %>


     ...


<asp:CalendarExtender ID="ce" runat="server" TargetControlID="txtce" FirstDayofWeek="Monday" PopupPosition="Right"></asp:CalendarExtender>
<asp:TextBox ID="txtce" runat="server" OnTextChanged="txtce_TextChanged"></asp:TextBox>

In the sample markup, the CalendarExtender appears when the TextBox is on focus. The SelectedDate appears on the TextBox. Below is the sample code-behind:

protected void txtce_TextChanged(object sender, EventArgs e)

{
DateTime dt = DateTime.Parse(txtce.Text);
Session["date"] = dt.Date;
}

You can put a breakpoint in the code-behind so you'll see that the server is able to get the data inside the TextBox.



Leave a Reply.