Click here to Skip to main content
15,900,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
You can only have one <head runat="server"> control on a page.



ASP.NET
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage2.master" AutoEventWireup="true"
    CodeFile="OtherSourceIncome_1.aspx.cs" Inherits="OtherSourceIncome" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <br />
    <br />
    <br />
    <br />

  
   <html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script type = "text/javascript">
        //This is the javascript function which will calulate the total
        function calculate() {

            var sub1 = document.getElementById('txtOSIInterstFromBank').value; // specify the subject1 text box id value
            var sub2 = document.getElementById('txtOSITDSFromBank').value; // specify the subject2 text box id value
            var sub3 = document.getElementById('txtOSIInterestFromDebent').value; // specify the subject3 text box id value

            if (sub1 == '') sub1 = 0;
            if (sub2 == '') sub2 = 0;
            if (sub3 == '') sub3 = 0;

            var total = parseInt(sub1) + parseInt(sub2) + parseInt(sub3);

            document.getElementById('txtOSITotalIncome').value = total;
        }
 
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Panel ID="Panel1" runat="server" Height="468px" Width="400px" BorderColor="BlueViolet"
            BorderStyle="Solid">
            <table class="style1">
                <tr>
                    <td class="style2" colspan="2" style="height: 24px">
                        <asp:Button ID="btn_Other_Income" runat="server" Text="Tax Computation" />
                    </td>
                </tr>
                <tr>
                    <td class="style2" colspan="2" style="height: 41px">
                        <asp:Label ID="Label14" runat="server" Text="Other Source Income">
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label1" runat="server" Text="Interest from Bank">
                         
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSIInterstFromBank" runat="server" onBlur="return calculate();" >
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label2" runat="server" Text="TDS from Bank">
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSITDSFromBank" runat="server" onBlur="return calculate();" >
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label3" runat="server" Text="Interest from Debentures">
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSIInterestFromDebent" runat="server" onBlur="return calculate();" >
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label5" runat="server" Text="TDS From NSS Withdrawal">
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSITDSFromNSSWithdr" runat="server">
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label6" runat="server" Text="Accured Interest on NSC">
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSIAccuredInterstOnNSC" runat="server">
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label7" runat="server" Text="Total Income">
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSITotalIncome" runat="server">
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label8" runat="server" Text="Total TDS">
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSITotalTDS" runat="server">
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label9" runat="server" Text="Previous Employer Details">
                    </td>
                    <td>
                         
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label10" runat="server" Text="Salary">
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSISalary" runat="server">
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label11" runat="server" Text="Professional Tax">
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSIProfessionalTax" runat="server">
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label12" runat="server" Text="PF Deducted">
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSIPFDeduction" runat="server">
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Label ID="Label13" runat="server" Text="TDS">
                    </td>
                    <td>
                        <asp:TextBox ID="txtOSITDS" runat="server">
                    </td>
                </tr>
                <tr>
                    <td>
                         
                    </td>
                    <td>
                         
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align: center">
                        <asp:Button ID="btnOSI_Save" runat="server" Text="Save" OnClick="btnOSI_Save_Click" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align: center">
                        <asp:Label ID="lblmessage" runat="server" Text="Label" Visible="False">
                    </td>
                </tr>
            </table>
        
    </div>
    </form>
</body>
</html>
Posted
Updated 11-May-12 6:33am
v2

You probably have
ASP.NET
<head  runat="server"></head>
on your master page.

Use "Content1" control to add stuff to head tag on master page,
and "Content2" for markup going to body.

Also loose html, head, body and form tags from child page, all those tags are already placed in the master page.
Child page should only add it's own markup only at places specified by ContentPlaceholder(s) on master page.

If you want complete control of whole page content, do not use master page.
 
Share this answer
 
v5
Comments
anurag19289 21-Nov-13 3:33am    
correct...
This is a stand alone web form but you are referencing a Master File (which also has a head element). Either remove: MasterPageFile="~/MasterPage2.master" or recreate this page as child of a master form.

A child form should look something like:

XML
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Working.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>


Place your content inside the Content2 element. You've also got a couple of ohter items to attend to but I'm sure you'll figure it out.
 
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