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

ClientEvents-OnValueChanged calculate sum Not working in Q2 2012

3 Answers 117 Views
Input
This is a migrated thread and some comments may be shown as answers.
Hu
Top achievements
Rank 1
Hu asked on 03 Jul 2012, 08:12 PM
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="mtidb_app.test" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="radsm" runat="server" EnablePageMethods="true" EnablePartialRendering="true" />  
    <telerik:RadWindowManager ID="RadWindowManager2" runat="server" EnableShadow="true" ></telerik:RadWindowManager>
    <telerik:RadAjaxManager ID="radam" runat="server" EnableHistory="True"></telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel id="LoadingPanel" Runat="server" Transparency="30" EnableSkinTransparency="false" Width="100%" Height="100%" BackgroundPosition="Center"  >   
    </telerik:RadAjaxLoadingPanel>  
    
    <telerik:RadAjaxPanel ID="radp4" runat="server" LoadingPanelID="LoadingPanel" Width="100%" >
    <telerik:RadCodeBlock ID="RadCodeBlock4" runat="server">
        <script type="text/javascript">
            function CalculateAdjustment() {
                var reg = $find("<%= tbAdjustReg.ClientID %>");
                var tuition = $find("<%= tbAdjustTuition.ClientID %>");
                var admin = $find("<%= tbAdjustAdmin.ClientID %>");
                var supply = $find("<%= tbAdjustSupply.ClientID %>");
                var uniform = $find("<%= tbAdjustUniform.ClientID %>");
                var textbook = $find("<%= tbAdjustTextbook.ClientID %>");
                var other = $find("<%= tbAdjustOther.ClientID %>");
                var tax = $find("<%= tbAdjustTax.ClientID %>");
                var total = $find("<%= tbAdjustTotal.ClientID %>");

              if (reg.get_value() == '') reg.set_value('0');
               if (tuition.get_value() == '') tuition.set_value('0');
                if (admin.get_value() == '') admin.set_value('0');
                if (supply.get_value() == '') supply.set_value('0');
                if (uniform.get_value() == '') uniform.set_value('0');
                if (textbook.get_value() == '') textbook.set_value('0');
                if (other.get_value() == '') other.set_value('0');
                if (tax.get_value() == '') tax.set_value('0');

                total.set_value(reg.get_value() + tuition.get_value() + admin.get_value() + supply.get_value() + uniform.get_value() + textbook.get_value() + other.get_value() + tax.get_value());
            }
        </script>
    </telerik:RadCodeBlock>                    

<div><telerik:RadNumericTextBox ID="tbAdjustReg" runat="server" ClientEvents-OnValueChanged="CalculateAdjustment" Type="Currency" NumberFormat-DecimalDigits="2" Width="110" /></div>
<div><telerik:RadNumericTextBox ID="tbAdjustTuition" ClientEvents-OnValueChanged="CalculateAdjustment" runat="server" Type="Currency" NumberFormat-DecimalDigits="2" Width="110" /></div>
<div><telerik:RadNumericTextBox ID="tbAdjustAdmin" ClientEvents-OnValueChanged="CalculateAdjustment" runat="server" Type="Currency" NumberFormat-DecimalDigits="2" Width="110" /></div>
<div><telerik:RadNumericTextBox ID="tbAdjustSupply" ClientEvents-OnValueChanged="CalculateAdjustment" runat="server" Type="Currency" NumberFormat-DecimalDigits="2" Width="110" /></div>
<div><telerik:RadNumericTextBox ID="tbAdjustTextbook" ClientEvents-OnValueChanged="CalculateAdjustment" runat="server" Type="Currency" NumberFormat-DecimalDigits="2" Width="110" /></div>
<div><telerik:RadNumericTextBox ID="tbAdjustUniform" ClientEvents-OnValueChanged="CalculateAdjustment" runat="server" Type="Currency" NumberFormat-DecimalDigits="2" Width="110" /></div>
<div><telerik:RadNumericTextBox ID="tbAdjustOther" ClientEvents-OnValueChanged="CalculateAdjustment" runat="server" Type="Currency" NumberFormat-DecimalDigits="2" Width="110" /></div>
<div><telerik:RadNumericTextBox ID="tbAdjustTax" ClientEvents-OnValueChanged="CalculateAdjustment" runat="server" Type="Currency" NumberFormat-DecimalDigits="2" Width="110" /></div>
<div><telerik:RadNumericTextBox ID="tbAdjustTotal" ReadOnly="true" runat="server" Type="Currency" NumberFormat-DecimalDigits="2" Width="110" /></div>
</telerik:RadAjaxPanel>
</form>
</body>
</html>


The code working well in v2.0.50727 version but when i try to switch Q2 2012, it is just stop working.
Pls hlp

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Jul 2012, 09:10 AM
Hello,

You can use _SetValue method instead of set_value method which fires the client event OnValueChanged event in Q2 2012. Here is the sample code.
   if (reg.get_value() == '') reg._SetValue('0');
if (tuition.get_value() == '') tuition._SetValue('0');
if (admin.get_value() == '') admin._SetValue('0');
if (supply.get_value() == '') supply._SetValue('0');
if (uniform.get_value() == '') uniform._SetValue('0');
if (textbook.get_value() == '') textbook._SetValue('0');
if (other.get_value() == '') other._SetValue('0');
if (tax.get_value() == '') tax._SetValue('0');

Thanks,
Shinu.
0
Hu
Top achievements
Rank 1
answered on 04 Jul 2012, 04:02 PM
Thanks for reply.
Yes, it works, but have another problem here.
I set all fields as Currency. and seems that _SetValue() just set the value, and "$" not showing.
I tried _SetValue('$0.00'); but it still just showing as "0" without currency symbol.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 05 Jul 2012, 05:16 AM
Hello,

I also observed the same behavior in Q2 2012. I was able to resolve it by setting set_displayValue(). Here is the sample code.
JS:
if (supply.get_value() == '') { supply._SetValue('0'); supply.set_displayValue('$0.00'); }
 if (uniform.get_value() == '') { uniform._SetValue('0'); uniform.set_displayValue('$0.00'); }
if (textbook.get_value() == '') { textbook._SetValue('0'); textbook.set_displayValue('$0.00'); }

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