Click here to Skip to main content
15,914,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I send three textbox control to the java script function parameter from asp:Content page which has master page.
but Java Script is not working...
java script:

JavaScript
function product(_control1,_control2,_return)
 {
    var a=document.getElementById('<%=_control1.ClientID%>').value
    var b=document.getElementById('<%=_control2.ClientID%>').value
     document.getElementById('<%=_return.ClientID%>').value=a*b;
     
 }


try 1:

ASP.NET
<%@ Page Language="C#" MasterPageFile="~/User/UserMasterPage.master" AutoEventWireup="true" CodeFile="NCDPolicyEntry.aspx.cs" Inherits="User_NCDPolicyEntry" Title="Entry" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<asp:TextBox ID="txtNumPol" runat="server" Width="20%" onKeyUp="product(this,document.getElementById('txtPol_Amt'),document.getElementById('txtTot_Pol_Amt')" >
</asp:TextBox>
</div>
</asp:Content>



try 2:

ASP.NET
<%@ Page Language="C#" MasterPageFile="~/User/UserMasterPage.master" AutoEventWireup="true" CodeFile="NCDPolicyEntry.aspx.cs" Inherits="User_NCDPolicyEntry" Title="Entry" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<asp:TextBox ID="txtNumPol" runat="server" Width="20%" onKeyUp="product(this,txtPol_Amt,txtTot_Pol_Amt)" >
</asp:TextBox>
</div>
</asp:Content>
Posted
Updated 13-Dec-11 22:50pm
v6

1 solution

Try this,
<asp:textbox id="txtNumPol" runat="server" width="20%" onkeyup="product(this)" xmlns:asp="#unknown">
</asp:textbox>



JavaScript
function product(_control1)
 {
var a = _control1.value;
var b= document.getElementById("_control2").value;
document.getElementById("_return").value=a*b;
 }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900