Try this:
Master Page code behind:
public partial class Site1 : System.Web.UI.MasterPage
{
public Dictionary<string, string> TempData;
}
Master Page:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="WebApplication1.Site1" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<% if (null != TempData && !string.IsNullOrEmpty(TempData["message"]))
{ %>
<div class="statusMessage">
<%= TempData["message"] %></div>
<% } %>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
Page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication1.WebForm2"
MasterPageFile="~/Site1.Master" %>
<asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:Button ID="btnsubmint" runat="server" Text="submit"
onclick="btnsubmint_Click" />
</asp:Content>
Page code behind:
public partial class WebForm2 : System.Web.UI.Page
{
protected void btnsubmint_Click(object sender, EventArgs e)
{
Site1 master = (Site1)(this.Master);
if (null == master.TempData) master.TempData = new Dictionary<string, string>();
master.TempData.Add("message", "Hello");
}
}
Good luck