I already have an aspx page where, lets say has a dataGrid with a list of movies (movie names as links), when the user clicks on a particular movie, I get the value of the pressed item from the dataGrid, but what I want is when the user clicks, a new page opens, lets say done.aspx using: Response.Redirect("done.aspx?user_id="+value)
But when creating the done.aspx page, how do I make it expect a parameter?
When I come to compile the aspx page, it doesn't recognize the parameter that was passed. Seems I need to define it somewhere
Sun JamesPosted Aug 3, 2005, 10:46 PM
You can use 'Server.Transfer' function:
Web page1:
public string Property1
{
get
{
return TextBox1.Text;
}
private void Button1_Click(object sender, System.EventArgs e)
{
Server.Transfer("Webform2.aspx");
}
Web page2:
// C#
public WebForm1 sourcepage;
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack){
WebForm1 sourcepage = (WebForm1) Context.Handler;
Label1.Text = sourcepage.Property1;
}
}
Mahesh ChandPosted Aug 3, 2005, 12:21 PM
session, and view states. View state is valid for that page only. Session state is valid for that session
only and application state is valid for the entire applications. Read some documents on
ASP.NET State Management and you will get better idea.
You can also pass values through command arguments and read command argument back.
Mihir SolankiPosted Aug 3, 2005, 12:10 PM
string userid = Request.QueryString["user_id"];
}
else{ // Invalid request // Userid is missing}
}