Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

MultiView Control with UpdatePanel Issue

$
0
0

Hi,

I am using MultiView Control and i am using UserControl in the view.

Here the issue is,  when i click on the button inside usercontrol,it is not firing.

(but when i remove the update panel it works fine),How to accomplish this using update.

Here is the code :

------------------------

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %><%@ Register Src="~/Calculator.ascx" TagName="Calculator" TagPrefix="Cal" %><!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>Sample Tabbed Page</title><link href="StyleSheet.css" rel="stylesheet" type="text/css" /></head><body><form id="form1" runat="server"><div><asp:ScriptManager ID="Sc1" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="up1" runat="server"><ContentTemplate><asp:Menu
            ID="Menu1"
            Width="168px"
            runat="server"
            Orientation="Horizontal"
            StaticEnableDefaultPopOutImage="False"
            OnMenuItemClick="Menu1_MenuItemClick"><Items><asp:MenuItem ImageUrl="~/selectedtab.GIF" Text=" " Value="0"></asp:MenuItem><asp:MenuItem ImageUrl="~/unselectedtab.GIF" Text=" " Value="1"></asp:MenuItem><asp:MenuItem ImageUrl="~/unselectedtab.GIF"  Text=" " Value="2"></asp:MenuItem></Items></asp:Menu><asp:MultiView
            ID="MultiView1"
            runat="server"
            ActiveViewIndex="0"  ><asp:View ID="Tab1" runat="server"  ><table width="600" height="400" cellpadding=0 cellspacing=0><tr valign="top"><td class="TabArea" style="width: 600px"><br /><br />
                            TAB VIEW 1
                            INSERT YOUR CONENT IN HERE
                            CHANGE SELECTED IMAGE URL AS NECESSARY</td></tr></table></asp:View><asp:View ID="Tab2" runat="server"><Cal:Calculator ID="Calculator1" runat="server" /></asp:View><asp:View ID="Tab3" runat="server"><table width="600px" height="400px" cellpadding=0 cellspacing=0><tr valign="top"><td class="TabArea" style="width: 600px"><br /><br />
                          TAB VIEW 3
                          INSERT YOUR CONENT IN HERE
                          CHANGE SELECTED IMAGE URL AS NECESSARY</td></tr></table></asp:View></asp:MultiView></div></ContentTemplate><Triggers><%--   <asp:AsyncPostBackTrigger EventName="click" />--%></Triggers></asp:UpdatePanel></form></body></html>

UserControl

--------------------

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Calculator.ascx.vb" Inherits="Calculator" %><script type="text/javascript" language="JavaScript">
    function get_round(X) { return Math.round(X * 100) / 100 }

    function showpay() {
        if ((document.getElementById('<%=loan.ClientID%>').value == "") || (document.getElementById('<%=months.ClientID%>').value == "") || (document.getElementById('<%=rate.ClientID%>').value == "")) {
            document.getElementById('<%=pay.ClientID%>').value = "Incomplete data";
            document.getElementById('<%=tot_amount.ClientID%>').value = "Incomplete data";
            document.getElementById('<%=tot_interest.ClientID%>').value = "Incomplete data";
            document.getElementById('<%=yearly_interest.ClientID%>').value = "Incomplete data";
            document.getElementById('<%=interest_pa.ClientID%>').value = "Incomplete data";
            document.getElementById('<%=interest_pm.ClientID%>').value = "Incomplete data";

        }
        else {


            var princ = document.getElementById('<%=loan.ClientID%>').value;
            var term = document.getElementById('<%=months.ClientID%>').value;
            var intr = document.getElementById('<%=rate.ClientID%>').value / 1200;
            var yrs = document.getElementById('<%=months.ClientID%>').value / 12;

            document.getElementById('<%=pay.ClientID%>').value = get_round(princ * intr / (1 - (Math.pow(1 / (1 + intr), term))));
            document.getElementById('<%=tot_amount.ClientID%>').value = get_round(document.getElementById('<%=pay.ClientID%>').value * term);
            document.getElementById('<%=tot_interest.ClientID%>').value = get_round(document.getElementById('<%=tot_amount.ClientID%>').value / yrs);
            document.getElementById('<%=yearly_interest.ClientID%>').value = get_round(document.getElementById('<%=tot_interest.ClientID%>').value / yrs);
            document.getElementById('<%=interest_pa.ClientID%>').value = get_round(document.getElementById('<%=yearly_interest.ClientID%>').value / princ * 100);
            document.getElementById('<%=interest_pm.ClientID%>').value = get_round((document.getElementById('<%=yearly_interest.ClientID%>').value / princ * 100) / 12);

        }
    }
</script><div id="Property_form"><div class="EMICALCdiv"><fieldset><h2>
            EMI Calculator</h2><table align="center" class="EMICCALCtblnew"><tbody><tr><td width="20%"><span class="label">Loan Amount<font color="#FF0000">*</font> </span></p></td><td style="margin-left: 5px" width="20%"><asp:TextBox ID="loan" runat="server" Width="200px" CssClass="propertydropdown"></asp:TextBox></td></tr><tr><td><p class="label">
                            Loan Tenure (Months)<font color="#FF0000" face="Verdana" size="2">*</font></p></td><td><asp:TextBox ID="months" runat="server" Width="200px" CssClass="propertydropdown"></asp:TextBox></td></tr><tr><td><p class="label">
                            Interest Rate (Reducing)<font color="#FF0000" face="Verdana" size="2">*</font></p></td><td><asp:TextBox ID="rate" runat="server" Width="200px" CssClass="propertydropdown"></asp:TextBox></td><td>
                        %</td></tr><tr><td><p class="label">
                            Monthly Payment (EMI)</p></td><td><p align="center"><input type="button" id="button" name="button" value="Click" class="normallink" onclick="showpay()" /><%--       <asp:Button ID="button" runat="server" Text="Click" OnClientClick="return showpay();" />--%></p></td></tr><tr><td><span class="label">Calculated Monthly EMI </span></td><td><asp:TextBox ID="pay" runat="server" Width="200px" CssClass="propertydropdown"></asp:TextBox></td></tr><tr><td><span class="label">Total Amount with Interest </span></td><td><asp:TextBox ID="tot_amount" runat="server" Width="200px" CssClass="propertydropdown"></asp:TextBox></td></tr><tr><td><span class="label">Flat Interest Rate PA </span></td><td width="109"><asp:TextBox ID="interest_pa" runat="server" Width="200px" CssClass="propertydropdown"></asp:TextBox></td></tr><tr><td><span class="label">Flat Interest Rate PM </span></td><td><asp:TextBox ID="interest_pm" runat="server" Width="200px" CssClass="propertydropdown"></asp:TextBox></td></tr><tr><td><span class="label">Total Interest Amount </span></td><td width="109"><asp:TextBox ID="tot_interest" runat="server" Width="200px" CssClass="propertydropdown"></asp:TextBox></td></tr><tr><td><span class="label">Yearly Interest Amount </span></td><td><asp:TextBox ID="yearly_interest" runat="server" Width="200px" CssClass="propertydropdown"></asp:TextBox></td></tr></tbody></table></fieldset></div></div>



Viewing all articles
Browse latest Browse all 5678

Trending Articles