I have below code
<script type="text/javascript">
$(document).ready(function () {
$("#ddlPackName").change(function () {
// Your requirment
sum();
});
});
function sum() {
debugger;
// var final;
var amountToPay = document.getElementById('<%=lblPrice.ClientID%>').value /*Here throwing Microsoft JScript runtime error: Object required*/
var noOfConn = document.getElementById('<%=txtNoOfConn.ClientID%>').value;
var chargePerConn = document.getElementById('<%=txtChargePerConn.ClientID%>').value;
var installCharge = document.getElementById('<%=txtInstallCharge.ClientID%>').value;
var discount = document.getElementById('<%=txtDiscount.ClientID%>').value;
var packPrice;
if (isNaN(amountToPay)) {
amountToPay = 0;
}
if (isNaN(noOfConn)) {
noOfConn = 0;
}
if (isNaN(chargePerConn)) {
chargePerConn = 0;
}
if (isNaN(installCharge)) {
installCharge = 0;
}
if (isNaN(discount)) {
discount = 0;
}
if (document.getElementById('<%=ddlConType.ClientID%>').selectedIndex == "1") {
if (document.getElementById('<%=ddlPackName.ClientID%>').selectedIndex != "0") {
packPrice = amountToPay;
packPrice = amountToPay + (noOfConn * chargePerConn);
packPrice = packPrice + installCharge;
packPrice = packPrice - discount;
if (!isNaN(packPrice)) {
document.getElementById('<%=txtAmntToPay.ClientID%>').value = packPrice;
}
}
else if (document.getElementById('<%=ddlPackName.ClientID%>').selectedIndex == "0") {
packPrice = noOfConn * chargePerConn;
packPrice = packPrice + installCharge;
packPrice = packPrice - discount;
if (!isNaN(packPrice)) {
document.getElementById('<%=txtAmntToPay.ClientID%>').value = packPrice;
}
}
}
}
</script>--%>
<asp:dropdownlist ID="ddlConType" runat="server" TabIndex="7">
<asp:ListItem Selected="True" Value="0">SELECT</asp:ListItem>
<asp:ListItem Value="1">Post Paid</asp:ListItem>
<asp:ListItem Value="2">Pre Paid</asp:ListItem>
</asp:dropdownlist>
<asp:dropdownlist ID="ddlPackName" runat="server" AutoPostBack="True"
TabIndex="11" onselectedindexchanged="ddlPackName_SelectedIndexChanged">
<asp:ListItem Value="0">Select</asp:ListItem>
</asp:dropdownlist>
<asp:TextBox ID="txtNoOfConn" runat="server" TabIndex="15" onkeypress="sum();">0</asp:TextBox>
<asp:TextBox ID="txtChargePerConn" runat="server" TabIndex="17" onkeypress="sum();">0</asp:TextBox>
<asp:TextBox ID="txtInstallCharge" runat="server" TabIndex="19" onKeypress="sum();">0</asp:TextBox>
<asp:TextBox ID="txtDiscount" runat="server" TabIndex="21" onKeypress="sum();">0</asp:TextBox>
<asp:TextBox ID="txtAmntToPay" runat="server" ReadOnly="True" TabIndex="23">0</asp:TextBox>
/*Microsoft JScript runtime error: Object required*/