|
|
|
start date: Mon, 06 Aug 2007 14:00:05 -0700,
posted on: microsoft.public.dotnet.framework.aspnet
back
| Thread Index |
|
1
David C
|
|
2
Cowboy \(Gregory A. Beamer\) oSpamM
|
|
3
Ross Culver
|
|
4
David C
|
sensible way to pass around values
With .NET 1.x, this is what I did. On the destination page
public class ToWebForm : System.Web.UI.Page
{
public const string PARAMETER = "PARAM";
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
string paramFromAnotherPage = Context.Items[PARAMETER].ToString();
Response.Write(paramFromAnotherPage);
}
}
}
And on the source page
Context.Items.Add(ToWebForm.PARAMETER, "value");
Server.Transfer("ToWebForm.aspx");
Basically I am creating an interface (not in a .net sense) on the
destination page so that the source page can simply use the string
constant as the name of the parameter.
..NET 2.0 does not seem to be happy with this. The funny thing is,
sometimes it works, and sometimes it does not even compile, which I
find very frustrating.
Is there any reason why this won't work well with partial classes?
And what is the sensible way to pass values from page to page without
having to copy and past the parameter names all over the web project?
Date:Mon, 06 Aug 2007 14:00:05 -0700
Author:
|
Re: sensible way to pass around values
..NET 2.0 is "last page aware". Try this:
http://msdn.microsoft.com/msdnmag/issues/05/10/ExtremeASPNET/
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
Co-author: Microsoft Expression Web Bible (upcoming)
************************************************
Think outside the box!
************************************************
"David C" wrote in message
news:1186434005.231509.3920@z24g2000prh.googlegroups.com...
> With .NET 1.x, this is what I did. On the destination page
>
> public class ToWebForm : System.Web.UI.Page
> {
> public const string PARAMETER = "PARAM";
> protected void Page_Load(object sender, System.EventArgs e)
> {
> if (!IsPostBack)
> {
> string paramFromAnotherPage = Context.Items[PARAMETER].ToString();
> Response.Write(paramFromAnotherPage);
> }
> }
> }
>
> And on the source page
> Context.Items.Add(ToWebForm.PARAMETER, "value");
> Server.Transfer("ToWebForm.aspx");
>
> Basically I am creating an interface (not in a .net sense) on the
> destination page so that the source page can simply use the string
> constant as the name of the parameter.
>
> .NET 2.0 does not seem to be happy with this. The funny thing is,
> sometimes it works, and sometimes it does not even compile, which I
> find very frustrating.
>
> Is there any reason why this won't work well with partial classes?
>
> And what is the sensible way to pass values from page to page without
> having to copy and past the parameter names all over the web project?
>
Date:Tue, 7 Aug 2007 08:20:04 -0500
Author:
|
Re: sensible way to pass around values
On Aug 7, 6:20 am, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> wrote:
> .NET 2.0 is "last page aware". Try this:http://msdn.microsoft.com/msdnmag/issues/05/10/ExtremeASPNET/
>
>
Thank you very much. I was pleasantly surprised to see that it even
reads the ViewState of the previous page.
Date:Tue, 07 Aug 2007 12:58:22 -0700
Author:
|
Re: sensible way to pass around values
Is there anyway to enable this for a gridview? Perhaps a user control or a
hidden button?
Ross
"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netNoSpamM> wrote in
message news:%234TxnWP2HHA.3940@TK2MSFTNGP05.phx.gbl...
> .NET 2.0 is "last page aware". Try this:
> http://msdn.microsoft.com/msdnmag/issues/05/10/ExtremeASPNET/
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
> http://gregorybeamer.spaces.live.com
> Co-author: Microsoft Expression Web Bible (upcoming)
>
> ************************************************
> Think outside the box!
> ************************************************
> "David C" wrote in message
> news:1186434005.231509.3920@z24g2000prh.googlegroups.com...
>> With .NET 1.x, this is what I did. On the destination page
>>
>> public class ToWebForm : System.Web.UI.Page
>> {
>> public const string PARAMETER = "PARAM";
>> protected void Page_Load(object sender, System.EventArgs e)
>> {
>> if (!IsPostBack)
>> {
>> string paramFromAnotherPage = Context.Items[PARAMETER].ToString();
>> Response.Write(paramFromAnotherPage);
>> }
>> }
>> }
>>
>> And on the source page
>> Context.Items.Add(ToWebForm.PARAMETER, "value");
>> Server.Transfer("ToWebForm.aspx");
>>
>> Basically I am creating an interface (not in a .net sense) on the
>> destination page so that the source page can simply use the string
>> constant as the name of the parameter.
>>
>> .NET 2.0 does not seem to be happy with this. The funny thing is,
>> sometimes it works, and sometimes it does not even compile, which I
>> find very frustrating.
>>
>> Is there any reason why this won't work well with partial classes?
>>
>> And what is the sensible way to pass values from page to page without
>> having to copy and past the parameter names all over the web project?
>>
>
>
Date:Tue, 7 Aug 2007 15:34:38 -0500
Author:
|
|
|