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

Discussion in 'ASP .Net' started by David Freeman, Nov 7, 2004.

  1. 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
    David Freeman, Nov 7, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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], Nov 7, 2004
    #2
    1. Advertising

  3. 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:...
    > 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" <> wrote in message
    > news:...
    >> 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
    >>
    >>

    >
    >
    David Freeman, Nov 8, 2004
    #3
  4. 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" <> wrote in message
    news:%...
    > 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:...
    > > 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" <> wrote in message
    > > news:...
    > >> 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], Nov 9, 2004
    #4
  5. Thanks Jeff.

    David

    "Jeffrey Palermo [MCP]" <http://dotnetjunkies.com/weblog/jpalermo> wrote in
    message news:...
    > 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" <> wrote in message
    > news:%...
    >> 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:...
    >> > 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" <> wrote in message
    >> > news:...
    >> >> 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
    >> >>
    >> >>
    >> >
    >> >

    >>
    >>

    >
    >
    David Freeman, Nov 9, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. darrel
    Replies:
    2
    Views:
    688
    darrel
    May 21, 2004
  2. Mike Kline
    Replies:
    1
    Views:
    579
    John Saunders
    Jan 7, 2005
  3. uto
    Replies:
    3
    Views:
    697
    Michael Hamrah
    Mar 8, 2006
  4. Fernando Chilvarguer

    Passing variables from ASPX page to ASCX control

    Fernando Chilvarguer, Aug 31, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    11,502
    Fernando Chilvarguer
    Sep 1, 2006
  5. David Freeman
    Replies:
    4
    Views:
    204
    David Freeman
    Nov 9, 2004
Loading...

Share This Page