I have a form with 2 Calendar Extneders that are linked to 2 Textboxes.
When I select a date in the calendar I want to call a function (CalculateDays) in code behind that calculates the difference between the 2 dates (first checking that 2 dates have been selected)
The first problem is that the function does not execute when I change the dates, so I added a linkbutton that calls the same function. In this case, when I click the linkbutton, the text (date) in both textboxes disappears, but the function is called - obvioulsy not returning the date difference because neither date is populated.
So, what I am trying to achieve is for the function to be called when a date is selected in the Calendar Extender and I would like to do this in code behind rather than Javascript. Is this possible?
<tr><td>First Date:</td><td><asp:Textbox ID="txtFromDate" runat="server" Text='' Columns="8" ForeColor="Blue" ReadOnly="true" OnTextChanged="CalculateDays" /><ajaxToolkit:CalendarExtender ID="calendar_From" TargetControlID="txtFromDate" Format="dd MMM yyyy" runat="server" /></td><td>Last Date:</td><td><asp:textbox ID="txtToDate" runat="server" Text='' Columns="8" ForeColor="Blue" ReadOnly="true" OnTextChanged="CalculateDays" /><ajaxToolkit:CalendarExtender ID="calendar_To" TargetControlID="txtToDate" Format="dd MMM yyyy" runat="server" /><asp:LinkButton id="lb" runat="server" OnClick="CalculateDays" Text="Click me" /></td></tr><tr><td>Days:</td><td><asp:Textbox ID="txtDays" runat="server" /></td></tr>
UPDATE: It seems that the Textbox values (dates) are disappearing on linkbutton click because the Textboxes are set to readonly. Removing readonly solves that problem, but I would rather that the users aren't able to type in the textboxes.
The main problem is still there - that when selecting a date from Calendar there appears to be no event firing (onTextChanged)