Connecting Tech Pros Worldwide Forums | Help | Site Map

Is Passing Parameters to an ASPX page like ASCX controls possible?

David Freeman
Guest
 
Posts: n/a
#1: Nov 18 '05
Hi There!

I'm just wondering if there's a way to pass parameters (as if you were
passing parameters to a ASCX web control) when calling an ASPX page?

e.g.
MyDetailsPage.UserName = "david"

OR... the only way to do it is to use the QueryString or Session object?

Thanks all in advance!!!

David



Jeffrey Palermo [MCP]
Guest
 
Posts: n/a
#2: Nov 18 '05

re: Is Passing Parameters to an ASPX page like ASCX controls possible?


David,
In your code-behind page, define a public property. Then, anywhere you
have context to your page, you can set this property. The most common,
easy, way, however is to use the querystring. I would recommend using that.

Of course, for the user, I would use Forms Authentication.

Best regards,
Jeffrey Palermo

"David Freeman" <no-email@mailingspam.com> wrote in message
news:OkOCm7MxEHA.4040@TK2MSFTNGP11.phx.gbl...[color=blue]
> Hi There!
>
> I'm just wondering if there's a way to pass parameters (as if you were
> passing parameters to a ASCX web control) when calling an ASPX page?
>
> e.g.
> MyDetailsPage.UserName = "david"
>
> OR... the only way to do it is to use the QueryString or Session object?
>
> Thanks all in advance!!!
>
> David
>
>[/color]


David Freeman
Guest
 
Posts: n/a
#3: Nov 18 '05

re: Is Passing Parameters to an ASPX page like ASCX controls possible?


Hi Jeff!

Thanks for the reply! But I'm not using code-behind model (because I don't
want to compile it while I'm developing). So this method can also be used in
the <script> block instead, right?

Another thing I want to clarify is that I want to pass parameters to
**another** ASPX page and not to the same ASPX page itself for postback. Can
this method be used for this?

For example, when I call "MyDetailsPage.aspx" from "home.aspx", I want to
pass parameters to "MyDetailsPage.aspx" like...

MyDetailsPage.UserName = "David"

Is this possible or am I hoping the impossible?

Thanks again!!

David

"Jeffrey Palermo [MCP]" <http://dotnetjunkies.com/weblog/jpalermo> wrote in
message news:OfcsZ7NxEHA.1392@tk2msftngp13.phx.gbl...[color=blue]
> David,
> In your code-behind page, define a public property. Then, anywhere
> you
> have context to your page, you can set this property. The most common,
> easy, way, however is to use the querystring. I would recommend using
> that.
>
> Of course, for the user, I would use Forms Authentication.
>
> Best regards,
> Jeffrey Palermo
>
> "David Freeman" <no-email@mailingspam.com> wrote in message
> news:OkOCm7MxEHA.4040@TK2MSFTNGP11.phx.gbl...[color=green]
>> Hi There!
>>
>> I'm just wondering if there's a way to pass parameters (as if you were
>> passing parameters to a ASCX web control) when calling an ASPX page?
>>
>> e.g.
>> MyDetailsPage.UserName = "david"
>>
>> OR... the only way to do it is to use the QueryString or Session object?
>>
>> Thanks all in advance!!!
>>
>> David
>>
>>[/color]
>
>[/color]


Jeffrey Palermo [MCP]
Guest
 
Posts: n/a
#4: Nov 18 '05

re: Is Passing Parameters to an ASPX page like ASCX controls possible?


David,
That's really not how HTTP posting works. In ASP.NET, data can be
passed to a page in several ways. Querystring, Form fields, and if you do a
Server.Transfer to the second page, then you can use the .Items collection.
I would recommend Request.Querystring or Request.Form.

So, yes, there is not way to call a second page and set a property on the
second page before doing the transfer.

Best regards,
Jeffrey Palermo

"David Freeman" <no-email@mailingspam.com> wrote in message
news:%23Ot07xUxEHA.2564@TK2MSFTNGP12.phx.gbl...[color=blue]
> Hi Jeff!
>
> Thanks for the reply! But I'm not using code-behind model (because I don't
> want to compile it while I'm developing). So this method can also be used[/color]
in[color=blue]
> the <script> block instead, right?
>
> Another thing I want to clarify is that I want to pass parameters to
> **another** ASPX page and not to the same ASPX page itself for postback.[/color]
Can[color=blue]
> this method be used for this?
>
> For example, when I call "MyDetailsPage.aspx" from "home.aspx", I want to
> pass parameters to "MyDetailsPage.aspx" like...
>
> MyDetailsPage.UserName = "David"
>
> Is this possible or am I hoping the impossible?
>
> Thanks again!!
>
> David
>
> "Jeffrey Palermo [MCP]" <http://dotnetjunkies.com/weblog/jpalermo> wrote[/color]
in[color=blue]
> message news:OfcsZ7NxEHA.1392@tk2msftngp13.phx.gbl...[color=green]
> > David,
> > In your code-behind page, define a public property. Then, anywhere
> > you
> > have context to your page, you can set this property. The most common,
> > easy, way, however is to use the querystring. I would recommend using
> > that.
> >
> > Of course, for the user, I would use Forms Authentication.
> >
> > Best regards,
> > Jeffrey Palermo
> >
> > "David Freeman" <no-email@mailingspam.com> wrote in message
> > news:OkOCm7MxEHA.4040@TK2MSFTNGP11.phx.gbl...[color=darkred]
> >> Hi There!
> >>
> >> I'm just wondering if there's a way to pass parameters (as if you were
> >> passing parameters to a ASCX web control) when calling an ASPX page?
> >>
> >> e.g.
> >> MyDetailsPage.UserName = "david"
> >>
> >> OR... the only way to do it is to use the QueryString or Session[/color][/color][/color]
object?[color=blue][color=green][color=darkred]
> >>
> >> Thanks all in advance!!!
> >>
> >> David
> >>
> >>[/color]
> >
> >[/color]
>
>[/color]


David Freeman
Guest
 
Posts: n/a
#5: Nov 18 '05

re: Is Passing Parameters to an ASPX page like ASCX controls possible?


Thanks Jeff.

David

"Jeffrey Palermo [MCP]" <http://dotnetjunkies.com/weblog/jpalermo> wrote in
message news:u3AeskgxEHA.3572@TK2MSFTNGP10.phx.gbl...[color=blue]
> David,
> That's really not how HTTP posting works. In ASP.NET, data can be
> passed to a page in several ways. Querystring, Form fields, and if you do
> a
> Server.Transfer to the second page, then you can use the .Items
> collection.
> I would recommend Request.Querystring or Request.Form.
>
> So, yes, there is not way to call a second page and set a property on the
> second page before doing the transfer.
>
> Best regards,
> Jeffrey Palermo
>
> "David Freeman" <no-email@mailingspam.com> wrote in message
> news:%23Ot07xUxEHA.2564@TK2MSFTNGP12.phx.gbl...[color=green]
>> Hi Jeff!
>>
>> Thanks for the reply! But I'm not using code-behind model (because I
>> don't
>> want to compile it while I'm developing). So this method can also be used[/color]
> in[color=green]
>> the <script> block instead, right?
>>
>> Another thing I want to clarify is that I want to pass parameters to
>> **another** ASPX page and not to the same ASPX page itself for postback.[/color]
> Can[color=green]
>> this method be used for this?
>>
>> For example, when I call "MyDetailsPage.aspx" from "home.aspx", I want to
>> pass parameters to "MyDetailsPage.aspx" like...
>>
>> MyDetailsPage.UserName = "David"
>>
>> Is this possible or am I hoping the impossible?
>>
>> Thanks again!!
>>
>> David
>>
>> "Jeffrey Palermo [MCP]" <http://dotnetjunkies.com/weblog/jpalermo> wrote[/color]
> in[color=green]
>> message news:OfcsZ7NxEHA.1392@tk2msftngp13.phx.gbl...[color=darkred]
>> > David,
>> > In your code-behind page, define a public property. Then, anywhere
>> > you
>> > have context to your page, you can set this property. The most common,
>> > easy, way, however is to use the querystring. I would recommend using
>> > that.
>> >
>> > Of course, for the user, I would use Forms Authentication.
>> >
>> > Best regards,
>> > Jeffrey Palermo
>> >
>> > "David Freeman" <no-email@mailingspam.com> wrote in message
>> > news:OkOCm7MxEHA.4040@TK2MSFTNGP11.phx.gbl...
>> >> Hi There!
>> >>
>> >> I'm just wondering if there's a way to pass parameters (as if you were
>> >> passing parameters to a ASCX web control) when calling an ASPX page?
>> >>
>> >> e.g.
>> >> MyDetailsPage.UserName = "david"
>> >>
>> >> OR... the only way to do it is to use the QueryString or Session[/color][/color]
> object?[color=green][color=darkred]
>> >>
>> >> Thanks all in advance!!!
>> >>
>> >> David
>> >>
>> >>
>> >
>> >[/color]
>>
>>[/color]
>
>[/color]


Closed Thread


Similar ASP.NET bytes