I have a MasterPage Named MyTemp.Master having 2 LinkButton Having Id
lbGreen lbBlue
In Code Behind File of MyTemp.Master i am populating session variable named COLROCODE with value Green and Blue on the click even of lbGreen And lbBlue Respectively
I have few other aspx pages those using this MyTemp.Master as Master page
i.e. default.aspx, custom.aspx etc. In these Child pages i m trying to read the session variables COLORCODE which is populated on lbGreen and lbBlue click event (these likbuttons are on masterpage and MasterPage codebheind file is having click event code)
but when i m click on Link button its not updating SessionVariable
This is my Master Page
<%@ Master Language="
VB" CodeFile="MasterPage.master.
vb" Inherits="MasterPage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
</head>
<body topmargin="0">
<form id="form1" runat="server">
<div>
<asp:LinkButton ID="lbGreen" runat="server" CausesValidation="False">Green</asp:LinkButton>
<asp:LinkButton ID="lbBlue" runat="server" CausesValidation="False">blue</asp:LinkButton>
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</body>
</html>
This is My CodeBehind for MasterPage
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Protected Sub lbBlue_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbBlue.Click
session("colorcode")="Blue"
End Sub
Protected Sub lbGreen_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbGreen.Click
session("colorcode")="Green"
End Sub
End Class
At first time when page loads i click on link button its popluate Session variable but after that its not updating session variable
Code behind for Child page
i have tried these codes on Page_PreInit, PageInit, PageLoad events
if not session("colorcode")=nothing then
response.write(session("colorcode").tostring)
end if
What wrong i am doing
Thank in advance