0

Using VS2012 to create a web application in VB, I have the following issue:

I create a asp:CalendarExtender that populates a asp:TextBox. This Textbox has the property Enabled="False" assigned to it. Once the asp:CalendarExtender has been called it will place a date in the TextBox in the format 'Sept 1 2000'.

I now want to use JQuery to detect this change. I have come across many examples which rely on a text change using the keyboard or a Blur, but none of these work. I have even attached a JQuery event to the button that triggers the Calendar to pop-up that removes the 'Enabled=False' property of the asp:TextBox [My train of thought was to remove the enabled property, allow the JQuery to detect a pasted change, then disable the textbox again]

Any ideas or suggestions gratefully received.

1 Answer 1

1

Do you need Enabled="False" on the TextBox, or would ReadOnly="True" suffice? Because the CalendarExtender will not pop up when you click the TextBox if the TextBox isn't enabled.

You could do something like this:

<script type="text/javascript">
  function alertChanged() {
    alert("Text changed.");
  }
</script>

With:

<asp:TextBox ID="tbxCalTest" runat="server" ReadOnly="true"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="calendarTest" runat="server" TargetControlID="tbxCalTest"
  OnClientDateSelectionChanged="alertChanged"></ajaxToolkit:CalendarExtender>
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you timbck2. It appears that the parameter OnClientDateSelectionChanged was the key to this issue. It didn't matter if the asp:TextBox had the parameters Enabled="False" or ReadOnly="true" as I am using a button to call the CalendarExtender control, but a useful tip nonetheless.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.