I have this RadDatePicker:
and I call this JS
With this line of code:
I have two problems with the above:
1)
I had to put the JS in the body section otherwise I get an error saying: "Impossible to modify the Controls collection because the control contains code blocks (like <% ... %>)".
2) The JS script does not have effect on the RadDatePicker, I mean the background color does not change and I do not get the focus either.
How can I change the background color and get the focus on the RadDatePicker?
Thanks for supporting
<tr> <td class="auto-style1">Birth Date: *</td> <td class="auto-style2">
<telerik:RadDatePicker ID="RadDatePicker1" runat="server" Culture="it-IT" MaxDate="2015-12-31" MinDate="1920-01-01"> </telerik:RadDatePicker> <asp:RequiredFieldValidator runat="server" ID="datevalidator" ControlToValidate="RadDatePicker1" Display="Dynamic" ForeColor="#FF3300" ErrorMessage="Enter a date!"></asp:RequiredFieldValidator> </td></tr>and I call this JS
<asp:Panel ID="Panel1" runat="server"> <script type="text/javascript">
function ageProb() { var DatePicker1 = $find("<%= RadDatePicker1.ClientID %>"); DatePicker1.get_dateInput()._textBoxElement.style.backgroundColor = "yellow"; DatePicker1.get_dateInput().focus(); } </script></asp:Panel>With this line of code:
ScriptManager.RegisterStartupScript(this, GetType(), "ageProb", "ageProb();", true);I have two problems with the above:
1)
I had to put the JS in the body section otherwise I get an error saying: "Impossible to modify the Controls collection because the control contains code blocks (like <% ... %>)".
2) The JS script does not have effect on the RadDatePicker, I mean the background color does not change and I do not get the focus either.
How can I change the background color and get the focus on the RadDatePicker?
Thanks for supporting
