hello all

i have one master page containing menu strip and one content page of same master page
what i want while i click on the menu strip the value clicked is shown to to text box on form for that i am using following code

master page's code

Partial Class MasterPage
    Inherits System.Web.UI.MasterPage



    Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick

        Session.Add("menu", e.Item.Value.ToString())
       

    End Sub
End Class

content page's code

Partial Class home
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Page.IsPostBack Then
            TextBox1.Text = Session("menu")
        End If

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Response.Redirect("Default.aspx")
    End Sub
End Class

and i am not getting the selected value in text box becouse while i am clicking on the menu strip is available on master page which loads after content page hence the text box of content page load first and then after the value inserted into session variable if i do refresh page then it will show the value in text box
so please anybody knows solution please help me 
i want to show the the value after immidiate click on menu strip

try using,

ctype(ContentPlaceHolder1.FindControl("textbox1"),TextBox).text=session("menu")

not woking but thanks for reply
help if have another idea

Did you try Session("menu").ToString()?

yes
thaks for help and have solved that problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.