Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have code in master page and content page
XML
<%@ Master Language="VB" CodeFile="UserSettings.master.vb" Inherits="UserSettings" %>

<!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>
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder id="Main" runat="server">

        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

and content page code is
XML
<%@ Page  Language="VB" MasterPageFile="~/UserSettings.master" AutoEventWireup="false" CodeFile="Default6.aspx.vb" Title="Untitled Page"   Inherits="Default6" %>

<html>
<head>
   <script runat="server">
     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Session("ProductName") = LinkButton1.Text
        LinkButton1.Attributes.Add("onclick", "window.open('promo.aspx',null,'height=360, width=420,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")

        Session("ProductName") = LinkButton2.Text
        LinkButton2.Attributes.Add("onclick", "window.open('promo.aspx',null,'height=360, width=420,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")

    End Sub
   </script>
</head>
<body>
<asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server">

    <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton_Click">Change Password </asp:LinkButton>
    <asp:LinkButton ID="LinkButton2" runat="server">Upload CV</asp:LinkButton>
</asp:Content>
</body>
</html>

I want link button on page i.e usersetting which work as a header for all pages after login but gives me an error as I mentioned in subject of the question.
Posted
Updated 5-Sep-10 23:09pm
v2

Your Page should not contain the following portion of HTML as these are already contained in the MasterPage:

XML
<html>

<head>
</head>

<body>
...
...
</body>

</html>


Most likely this is the problem. So, remove these form the Page.

Your content page should only contain the JavaScript and the following code:

XML
<script runat="server">
     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Session("ProductName") = LinkButton1.Text
        LinkButton1.Attributes.Add("onclick", "window.open('promo.aspx',null,'height=360, width=420,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
        Session("ProductName") = LinkButton2.Text
        LinkButton2.Attributes.Add("onclick", "window.open('promo.aspx',null,'height=360, width=420,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');")
    End Sub
   </script>

<asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server">
    <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton_Click">Change Password </asp:LinkButton>
    <asp:LinkButton ID="LinkButton2" runat="server">Upload CV</asp:LinkButton>
</asp:Content>
 
Share this answer
 
v2
content page code is

your content page is acutally not a real contect page.

you must
add new items=>contenct page not web forms.
 
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