None of the events appear to fire for the extender. I would like a person to select a date on the first calendar and have that date as the staring date for the second calender.
Thanksc
Hi sox21,
Use the client event of the textbox.
When the text changes, put the text in the other textbox.
Because the text is in the other textbox, that text (= which is a date) will be the Selected date for the 2nd calendar!
Is this what you are looking for?
... <script type="text/javascript"> function setDate(sender) { var mytxt = document.getElementById('TextBox5'); mytxt.value = sender.value; } </script></head><body> <form id="form1" runat="server"> <div> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <br /> <asp:TextBox ID="TextBox1" runat="server" onchange="setDate(this);"></asp:TextBox> <cc1:CalendarExtender ID="CalendarExtender1"runat="server" Enabled="True" TargetControlID="TextBox1"> </cc1:CalendarExtender> <br /> <asp:TextBox ID="TextBox5" runat="server" ></asp:TextBox> <cc1:CalendarExtender ID="CalendarExtender5"runat="server" Enabled="True" TargetControlID="TextBox5"> </cc1:CalendarExtender> </div>...
Kind regards,
Wim
I am able to get this code working on a blank page but it does not work when I add it to my page. My page uses a master page. When I enter the client script in debug, the sender is valued as expected but mytxt is set to null and throws a JS Error. Any ideas?
Thanks
try
document.getelementbyid("<%= TextBox5.ClientID >")
when the content and master merge to get rendered, the ID's of controls get renamed. Just look at the source through the browser to check this behavior!!!
EDIT:; also note that the text gets set but the selectedDate in the calendarExtender is not changed! --> Am I right about this? I think I noticed this behavior
Kind regards,
wim
That did the trick. Also, the selected date on the calendar does change. This is the exact behavior I was looking for.
Thanks!!!
No comments:
Post a Comment