Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2008, 05:50 PM
Registered User
 
Join Date: Feb 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gurbaksh
Default Updating Session Variab from Master Page

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




Similar Threads
Thread Thread Starter Forum Replies Last Post
Session Not available Problem in Master Page cbe_seenu ASP.NET 2.0 Professional 0 July 31st, 2006 08:47 AM
Master-Detail example with Session variable bpdsmark ASP.NET 2.0 Basics 3 March 11th, 2006 10:57 PM
updating a master table Hudson40 Access VBA 4 February 4th, 2005 11:56 AM
Detail-Master updating problem CW Classic ASP Databases 2 October 22nd, 2003 10:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.