bobetko
bobetko

Reputation: 5168

How to make PostBack from one page to another and pass parameters?

I need to make PostBack from source page to destination page. Destination page expects several parameters to be past to it. (I don't have control over destination, I just know what parameters are expected).

For example destination page expects 3 parameters:
param1
param2
param3

My source page has controls with ids param1, param2 and param3, but because I am using master pages my controls get altered to:
ctl00$param1
ctl00$param2
ctl00$param3

So when I do PostBack destination page doesn't receive parameters it expects. How do I get around that?

What is proper way to do this?

Thanks

Upvotes: 2

Views: 439

Answers (1)

Nickz
Nickz

Reputation: 1880

You can post to another page using Server.Transfer with

HttpContext.Current.Items["CustomerName"] = "Fred";

The following post outlines your option(s). Cross Page Postback and passing info from source to destination page

more info about HttpContext Items: https://web.archive.org/web/20201202215202/https://www.4guysfromrolla.com/articles/060904-1.aspx

Upvotes: 2

Related Questions