This is a migrated thread and some comments may be shown as answers.

Client Side Enable Disable RadNumerictextBox and RadDateTimePicker

1 Answer 163 Views
Input
This is a migrated thread and some comments may be shown as answers.
Sintayehu
Top achievements
Rank 1
Sintayehu asked on 27 Aug 2008, 09:11 PM
First of Is it possible to enable and disable this controls with javascript if so, Here is what I tried so far...

I found that your client objects have the folowwing two methods
enable no param no param Enables the date input control.
disable no param no param Disables the date input control.

Also I read that the javascript disable property won't work with <input type="hiden"/> which is what the controls are. So I think that is why you provided the two methods above.

**********************************************************
 I tried.....

<

script type="text/javascript" language=javascript>
function toggle_RadNumericTextBox(obj) {

if (obj.checked) {

//document.getElementById('<%=RadNumericTextBox1.ClientID%>').enable();//document.getElementById('<%=TextBox1.ClientID%>').disabled = true; this won't work becaust the input is hidden
$find("<%= RadNumericTextBox1.ClientID %>").enable();

}

else

$find(

"<%= RadNumericTextBox1.ClientID %>").disabled();

//document.getElementById('<%=RadNumericTextBox1.ClientID%>').disabled = true;

//document.getElementById('<%=TextBox1.ClientID%>').disabled = false;

}

function toggle_RadDateTimePicker(obj) {
if (obj.checked) {

document.getElementById(

'<%=RadDateTimePicker1.ClientID%>').disabled = false;

}

else

document.getElementById(

'<%=RadDateTimePicker1.ClientID%>').disabled = true;

}

function toggle_TextBox(obj) {

if (obj.checked) {

document.getElementById(

'<%=TextBox1.ClientID%>').disabled = false;

}

else

document.getElementById(

'<%=TextBox1.ClientID%>').disabled = true;

}

</

script>

<telerik:RadScriptManager ID="RadScriptManager1" runat="server"

OutputCompression="AutoDetect">

</telerik:RadScriptManager>

<div>

<asp:CheckBox ID="CheckBox1" runat="server" onclick="toggle_RadNumericTextBox(this);" />

<br />

<telerik:RadNumericTextBox ID="RadNumericTextBox1" Runat="server" >

</telerik:RadNumericTextBox>

<br />

<asp:CheckBox ID="CheckBox2" runat="server" onclick="toggle_RadDateTimePicker(this);"/>

<br />

<telerik:RadDateTimePicker ID="RadDateTimePicker1" Runat="server"

Culture="English (United States)">

</telerik:RadDateTimePicker>

<br />

<asp:CheckBox ID="CheckBox3" runat="server" onclick="toggle_TextBox(this);" />

<br />

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

<br />

</div>

Your help is appreciated.

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 28 Aug 2008, 11:32 AM
Hello luay,


Please find attached the sample web application that demonstrates the needed approach

Best wishes,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Input
Asked by
Sintayehu
Top achievements
Rank 1
Answers by
Missing User
Share this question
or