Hi Everyone,
I've decided to start using javascript to do some client side math instead of doing it behind code. I started to test it out with the below page. It work but before updating RadNumericTextBox3, it throw an error message "Error: Object expected". I look into the browser developer tool and it throw this code "t[r](n,i)". Just to point out, Firefox and Chrome didn't display the error but when I look in the developer tool, I see the same code ""t[r](n,i)". What am I doing wrong? How can I fix it? PS: the radscriptmanager is in the masterpage.
I've decided to start using javascript to do some client side math instead of doing it behind code. I started to test it out with the below page. It work but before updating RadNumericTextBox3, it throw an error message "Error: Object expected". I look into the browser developer tool and it throw this code "t[r](n,i)". Just to point out, Firefox and Chrome didn't display the error but when I look in the developer tool, I see the same code ""t[r](n,i)". What am I doing wrong? How can I fix it? PS: the radscriptmanager is in the masterpage.
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="JavaScriptTextBox.aspx.cs" Inherits="TBSWeb.Lab.JavaScriptTextBox" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"HeadContent"
runat
=
"server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"MainContent"
runat
=
"server"
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function timesValues() {
var radTextBox1 = $find("<%= RadNumericTextBox1.ClientID %>");
var radTextBox2 = $find("<%= RadNumericTextBox2.ClientID %>");
var radTextBox3 = $find("<%= RadNumericTextBox3.ClientID %>");
if (radTextBox1.get_value() != "" || radTextBox2.get_value() != "") {
var total = radTextBox1.get_value() * radTextBox2.get_value();
radTextBox3.set_value(total);
}
}
</
script
>
</
telerik:RadCodeBlock
>
<
telerik:RadNumericTextBox
ID
=
"RadNumericTextBox1"
runat
=
"server"
>
</
telerik:RadNumericTextBox
>
<
telerik:RadNumericTextBox
ID
=
"RadNumericTextBox2"
runat
=
"server"
>
</
telerik:RadNumericTextBox
>
<
telerik:RadNumericTextBox
ID
=
"RadNumericTextBox3"
runat
=
"server"
>
</
telerik:RadNumericTextBox
>
<
telerik:RadButton
ID
=
"btnCalculate"
runat
=
"server"
Text
=
"Calculate"
OnClientClicked
=
"timesValues()"
>
</
telerik:RadButton
>
</
asp:Content
>