I try to get a date from CalendarExtender in two ways: one with an update and one without it, but it does not work. the value of this two calendar extenders is null.
This is strange because I can select a date from these extenders, and the text of the text fields is set to the selected date.
How to fix it?
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="tbPlannedStart"
Format="d">
</asp:CalendarExtender>
<asp:TextBox ID="tbPlannedStart" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
<asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="tbPlannedEnd"
Format="d">
</asp:CalendarExtender>
<asp:TextBox ID="tbPlannedEnd" runat="server"></asp:TextBox>
protected void btnAddProject_Click(object sender, EventArgs e)
{
var service = new Service1Client("WSHttpBinding_IService13");
var project = new MyProject();
project.PlannedEnd = CalendarExtender2.SelectedDate;
project.PlannedStart = CalendarExtender1.SelectedDate;
service.AddProject(project);
}
source
share