Referencing values from aspx page to aspx page

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???
 
P

Peter Rilling

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???
 
G

Guest

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???
 
D

DalePres

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???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top