Hi Imar
I was looking at the articale you posted and tried something but it did not worked.
I have a master page with the folloing in it:
Quote:
<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
<!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 runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox runat="server" id="QueryBox" />
<asp:Button runat="server" ID="SearchButton" Text="Search"
PostBackUrl="~/Default1.aspx"/>
<div>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<asp:Label runat="server" ID="FooterLabel"
Text="Default footer text" />
</form>
</body>
</html>
|
and in the code behind:
Quote:
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Public Property FooterText() As String
Get
Return FooterLabel.Text
End Get
Set(ByVal value As String)
FooterLabel.Text = value
End Set
End Property
Public Property SearchText() As String
Get
Return QueryBox.Text
End Get
Set(ByVal value As String)
QueryBox.Text = value
End Set
End Property
End Class
|
also page 1 : default1.aspx:
Quote:
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default1.aspx.vb" Inherits="Default1" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</asp:Content>
|
and code beind:
Quote:
Partial Class Default1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Master.FooterText = "some text"
Label1.Text = Master.SearchText
End Sub
End Class
|
and page 2 Default2.aspx:
Quote:
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
|
no code behind.
according to the articale the @ MasterType directive in Default1 and in Default2 causes them both to reference the master page
but when clicking on Search button while in Default2.aspx the browser go to Default1.aspx but does not display the enterd text in QueryBox and the textbox is empty
what am I missing here? does the postbackurl does not post the textbox text?
thank you very much
Barak