ClientEvents Problem

3 posts, 0 answers
  1. Steven
    Steven avatar
    2 posts
    Member since:
    Sep 2011

    Posted 03 Jun 2012 Link to this post

    Please can someone provide some guidance on why the following is not working.

    <telerik:RadNumericTextBox ID="lnVoltage" runat="server" Label="Voltage (V): " Width="160" ToolTip="Three phase voltage" MinValue="0" MaxValue="1000" Value="400" NumberFormat-DecimalDigits="0"  DataType="Double" ShowSpinButtons="true" >
    <ClientEvents OnValueChanged="singlePhVoltage" OnLoad="singlePhVoltage" />
    </telerik:RadNumericTextBox>
     
          <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
                <script type="text/javascript">
                <!--
                    function singlePhVoltage(sender, eventArgs) {
                        alert("in function");
                    }
                -->
                </script>
            </telerik:RadCodeBlock>

     

    When I change the textBox value the function is not being called.  Have tried several things.

  2. Vasil
    Admin
    Vasil avatar
    1635 posts

    Posted 04 Jun 2012 Link to this post

    Hello Steven,

    Write comment "//" before the "<!--" and "-->", otherwise your javascript is invalid in the browser. This could be an issue if you run in older IE.

    <telerik:RadNumericTextBox ID="lnVoltage" runat="server" Label="Voltage (V): " Width="160"
        ToolTip="Three phase voltage" MinValue="0" MaxValue="1000" Value="400" NumberFormat-DecimalDigits="0"
        DataType="Double" ShowSpinButtons="true">
        <ClientEvents OnValueChanged="singlePhVoltage" OnLoad="singlePhVoltage" />
    </telerik:RadNumericTextBox>
    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
        <script type="text/javascript">
            //<!--
            function singlePhVoltage(sender, eventArgs)
            {
                alert("in function");
            }
            //-->
    </script>
    </telerik:RadCodeBlock>

    I tried the modified code with the latest version of our controls and it is working correctly.

    All the best,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Steven
    Steven avatar
    2 posts
    Member since:
    Sep 2011

    Posted 04 Jun 2012 Link to this post

    Vasil, thanks for answering.

    I have just found the issue.  There was an error in another javascript function (problaby stopped all the controls loading properly).  Once I fixed this everything worked.
Back to Top