Reputation: 4028
I have a webpage 'WPwp1.aspx' and another webpage 'FLcourt.aspx'
In WPwp1.aspx
i have DropDownList2,DropDownList3,TextBox1,TextBox2,TextBox3 and a LinkButton1
FLcourt.aspx
.FLcourt.aspx
also has the controls
that are there inWPwp1.aspx
(DropDownList2,DropDownList3,TextBox1,TextBox2,TextBox3)When user input value in the controls present in WPwp1.aspx
and clicks on LinkButton1, the user should be able to see all the values that were being given as input in 'WPwp1.aspx' into the asp.net controls in 'FLcourt.aspx'.
How is it possible to pass values being input in some controls in a webpage to similar controls in another webpage?
Upvotes: 0
Views: 2103
Reputation: 17367
Yes, you have several options:
Response.Redirect
, store
your values in Session
and get them in the Page_Load
of the target page.Using QueryString
. Pass the values in a query string:
Response.Redirect(
string.Format("FLcourt.aspx?value1={0}&value2={1}",
HttpUtility.UrlEncode(value1),
HttpUtility.UrlEncode(value2)));
And in the second page:
var value1 = Request.QueryString["value1"];
UPDATE
Using cookies (the client's browser must have them enabled). Set cookies before Redirect:
Response.Cookies["MyValues"]["Value1"] = value1;
In the target page:
if(Request.Cookies["MyValues"] != null)
{
var value1 = Request.Cookies["MyValues"]["Value1"];
//...
}
(but you have to check that Request.Cookies["MyValues"]
is not null before)
Upvotes: 1
Reputation: 3766
http://www.herongyang.com/VBScript/IIS-ASP-Object-Example-Pass-Value-between-Pages.html
its shown how you do it between two pages.
Upvotes: 0
Reputation: 6999
Upvotes: 0
Reputation: 5201
You can try this out.
In your source page ("WPwp1.aspx") create properties for each control i.e. DropDownList2,DropDownList3,TextBox1,TextBox2,TextBox3.
Give "PostBackUrl" property of the linkbutton to the page you want to redirect, in your case it will be "FLcourt.aspx".
In the destination page ("FLcourt.aspx") access the previous page with the help of "PreviousPage" class. This class will give you the properties which you have written in point1.
Hope this helps!
Regards,
Samar
Upvotes: 0
Reputation: 1285
See: http://msdn.microsoft.com/en-us/library/6c3yckfw.aspx
To summarize and answer your question directly, you can:
And since both pages appear to be in the same Web Application, you can also:
PreviousPage
object. This option has a particular performance disadvantage as a call to PreviousPage
results in the instantiation of the object and the processing of its life-cycle up to, but not including PreRender
.Sometimes, though, it is simpler to avoid cross-page postbacks and simulate the multiple pages/stages with Panel
or MultiView
controls.
Upvotes: 0