Referencing values from aspx page to aspx page

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using this code to create a passable parameter
<%@ Page Language="C#" ClassName="FirstPageClass" %><html><head><script runat="server"

public string FirstName
{
get
{
return first.Text;
}


public string LastName
{
get
{
return last.Text;
}


void ButtonClicked(object sender, EventArgs e)
{
Server.Transfer("secondpage.aspx");


</script>

this allows the parameter to be accessed from another page that references it, but the value seems to be only used in certain conditions... any suggestions to pass variables from aspx page to aspx page???
 
Session variables.

Lane said:
Using this code to create a passable parameter
<%@ Page Language="C#" ClassName="FirstPageClass" %><html><head><script runat="server">

public string FirstName
{
get
{
return first.Text;
}
}

public string LastName
{
get
{
return last.Text;
}
}

void ButtonClicked(object sender, EventArgs e)
{
Server.Transfer("secondpage.aspx");
}

</script>

this allows the parameter to be accessed from another page that references
it, but the value seems to be only used in certain conditions... any
suggestions to pass variables from aspx page to aspx page???
 
for passing small amount of data that only needed for the duration of a request, the cleanest solution is to use HttpContext.Items

----- Lane wrote: ----

Using this code to create a passable parameter
<%@ Page Language="C#" ClassName="FirstPageClass" %><html><head><script runat="server"

public string FirstName
{
get
{
return first.Text;
}


public string LastName
{
get
{
return last.Text;
}


void ButtonClicked(object sender, EventArgs e)
{
Server.Transfer("secondpage.aspx");


</script>

this allows the parameter to be accessed from another page that references it, but the value seems to be only used in certain conditions... any suggestions to pass variables from aspx page to aspx page???
 
Look at
http://msdn.microsoft.com/library/d...ml/vbtskpassingvaluesbetweenwebformspages.asp

That's much easier, I think, than the inline code you're doing. I use the
method outlined in the link above a lot and have never had any problems
accessing the properties of the source page.

Good luck,

Dale



Lane said:
Using this code to create a passable parameter
<%@ Page Language="C#" ClassName="FirstPageClass" %><html><head><script runat="server">

public string FirstName
{
get
{
return first.Text;
}
}

public string LastName
{
get
{
return last.Text;
}
}

void ButtonClicked(object sender, EventArgs e)
{
Server.Transfer("secondpage.aspx");
}

</script>

this allows the parameter to be accessed from another page that references
it, but the value seems to be only used in certain conditions... any
suggestions to pass variables from aspx page to aspx page???
 
Back
Top