Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2103
  • Last Modified:

How to pass variable from master page to contents page on postback?

Hi All,
My master page has a dropdown box with a submit button.
When user clicks the button I need to send selecteditem's value  to the contents page's page_load event.

Can someone please give me the *** code ***, preferably in C#.

Much appreciated.

Thanks
0
ctncomms
Asked:
ctncomms
1 Solution
 
scorpiiaCommented:
To send the parameters:
Response.Redirect("StaffProfile.aspx?StaffID=" + parameter.ToString());

StaffProfile is the page you want to redirected to.
Parameter is the one you want to pass


To get the Parameters:

 parameter= int.Parse(Request.Params.Get("StaffID").ToString());

you don't need to use Int, the data type can be different
0
 
ctncommsAuthor Commented:
Hi Scorpiia,
I can not use querystring or cookies or sessions.

Thanks for your time.

Any other approach? like using properties? or whatever?

0
 
samtran0331Commented:
Yes, properties (variables, controls, events) made public can be read between a master/content page.
This is a nice, short article on it:
http://aspnet.4guysfromrolla.com/articles/013107-1.aspx
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now