problem for enable/disable RadTextBox via RadCheckbox in client side

3 posts, 0 answers
  1. Saman
    Saman avatar
    4 posts
    Member since:
    Feb 2013

    Posted 25 Feb 2013 Link to this post

    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. Saman
    Saman avatar
    4 posts
    Member since:
    Feb 2013

    Posted 26 Feb 2013 Link to this post

    Please Help Me...anybody know  solution for this problem...
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Feb 2013 Link to this post

    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.
Back to Top