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

ClientEvents Problem

2 Answers 102 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 03 Jun 2012, 04:01 PM

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 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 04 Jun 2012, 03:02 PM
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.
0
Steven
Top achievements
Rank 1
answered on 04 Jun 2012, 03:19 PM
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.
Tags
General Discussions
Asked by
Steven
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Steven
Top achievements
Rank 1
Share this question
or