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

problem for enable/disable RadTextBox via RadCheckbox in client side

2 Answers 286 Views
Input
This is a migrated thread and some comments may be shown as answers.
Saman
Top achievements
Rank 1
Saman asked on 25 Feb 2013, 12:34 PM
hello, i want to create a dynamic text box that it can enable/disable by OnClientCkeckChange of a Radcheckbox button ...my code is :

   <script type="text/javascript">
        function changedclient() {
 
            var textBox = $find("RadTextBox1");
            var button = $find("RadButton1");
            if (button.get_checked()) {
 
                textBox.set_value("");
                textBox.disable();
                
            }
            else {
 
 
                textBox.enable();
            }
        }
     
    </script>
 
 
-------------------------------------------
 
 <asp:ScriptManager ID="RadScriptManager1" runat="server"></asp:ScriptManager>
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" />    
        <telerik:RadButton ID="RadButton1" runat="server" AutoPostBack="False" ToggleType="CheckBox" ButtonType="ToggleButton" OnClientCheckedChanged="changedclient()">
        </telerik:RadButton>
 
        <br/>
        <telerik:RadTextBox ID="RadTextBox1" runat="server" Font-Names="tahoma">
            <FocusedStyle BackColor="#FFFFCC" BorderColor="Red" />
        </telerik:RadTextBox> 
.
.
.
.

But not working....

2 Answers, 1 is accepted

Sort by
0
Saman
Top achievements
Rank 1
answered on 26 Feb 2013, 12:23 PM
Please Help Me...anybody know  solution for this problem...
0
Shinu
Top achievements
Rank 2
answered on 27 Feb 2013, 04:22 AM
Hello Saman,

Your issue is, when you are attaching a javascript to the client events of any RadControl there is no need of the "()". Instead of giving OnClientCheckedChanged="changedclient()", simply give OnClientCheckedChanged="changedclient". Please have a look at the following mark up.

ASPX:
<telerik:RadButton ID="RadButton1" runat="server" AutoPostBack="False" ToggleType="CheckBox"
    ButtonType="ToggleButton" OnClientCheckedChanged="changedclient">
</telerik:RadButton>

Thanks,
Shinu.
Tags
Input
Asked by
Saman
Top achievements
Rank 1
Answers by
Saman
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or