Very Basic Question

Discussion in 'ASP General' started by James Baker, Jun 4, 2004.

  1. James Baker

    James Baker Guest

    I'm getting a QueryString on a page. From this query string, I need to
    query a database, get a bunch of file names, attach them to an e-mail and
    fire it out (no problem). The problem is, I want it to happen when a user
    clicks a button.

    I've been using .NET for so long (this isn't a problem at all in .NET
    obviously)...that I've forgotten how to handle this. Am I going to need a
    second page to post an array of the file names to and then handle it there?
    It just seems awfully redundant to need a second page to handle all of this,
    but I guess it wouldn't shock me. It's been years since I've used classic
    ASP, so bear with me =).
    James Baker, Jun 4, 2004
    #1
    1. Advertising

  2. You can post the page to itself (default behaviour, if you don't specify the
    second page). You need to set a hidden variable so you know if you are
    entering the page the first time, or if it is a postback. Sorry, classic ASP
    does not support isPostBack :)

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "James Baker" <> wrote in message
    news:...
    > I'm getting a QueryString on a page. From this query string, I need to
    > query a database, get a bunch of file names, attach them to an e-mail and
    > fire it out (no problem). The problem is, I want it to happen when a user
    > clicks a button.
    >
    > I've been using .NET for so long (this isn't a problem at all in .NET
    > obviously)...that I've forgotten how to handle this. Am I going to need a
    > second page to post an array of the file names to and then handle it

    there?
    > It just seems awfully redundant to need a second page to handle all of

    this,
    > but I guess it wouldn't shock me. It's been years since I've used classic
    > ASP, so bear with me =).
    >
    >
    Manohar Kamath [MVP], Jun 4, 2004
    #2
    1. Advertising

  3. James Baker

    James Baker Guest

    I'm creating a bunch of hidden values for each file that needs to be loaded.
    If I set the target to itself (I assume via action='self.asp'), how do I
    determine if it's a postback? Just do a Request.Form of the hidden values
    and make sure to make them distinct from any values I had on the previous
    form? I figure I just answered my own question, but just making sure I have
    the concept right before I charge forward on this.

    Thanks!
    James
    James Baker, Jun 4, 2004
    #3
  4. James Baker

    James Baker Guest

    You have no idea how many times I've tried to type that =). Using entirely
    wrong syntax for VBScript too. Every page I've typed:

    if (!IsPostBack)

    and then hit backspace 15 times. I'll re-get the hang of it I suppose.

    But you're saying that if I have no "action" attribute of my form, it will
    default to posting to itself?

    Thanks,
    James
    James Baker, Jun 4, 2004
    #4
  5. That's correct... leaving action attribute empty lets the page post to
    itself.

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "James Baker" <> wrote in message
    news:%...
    > You have no idea how many times I've tried to type that =). Using

    entirely
    > wrong syntax for VBScript too. Every page I've typed:
    >
    > if (!IsPostBack)
    >
    > and then hit backspace 15 times. I'll re-get the hang of it I suppose.
    >
    > But you're saying that if I have no "action" attribute of my form, it will
    > default to posting to itself?
    >
    > Thanks,
    > James
    >
    >
    Manohar Kamath [MVP], Jun 4, 2004
    #5
  6. Rather than checking for hidden values, you could check the HTTP verb to see
    if it is a postback or not. If it is POST, it is. If it is GET, it isn't.
    You can use Request.ServerVariables("REQUEST_METHOD").

    Paul

    "James Baker" <> wrote in message
    news:%...
    > You have no idea how many times I've tried to type that =). Using

    entirely
    > wrong syntax for VBScript too. Every page I've typed:
    >
    > if (!IsPostBack)
    >
    > and then hit backspace 15 times. I'll re-get the hang of it I suppose.
    >
    > But you're saying that if I have no "action" attribute of my form, it will
    > default to posting to itself?
    >
    > Thanks,
    > James
    >
    >
    Paul Baker [MVP, Windows - SDK], Jun 4, 2004
    #6
  7. Well, the second page does allow you to provide a confirmation that the
    process succeeded. So don't think of it as a second page, but rather as
    a confirmation and of course you can setup things up so that if the
    second page fails, an error page is presented instead of a confirmation.

    David C. Holley
    www.gatewayorlando.com

    James Baker wrote:
    > I'm getting a QueryString on a page. From this query string, I need to
    > query a database, get a bunch of file names, attach them to an e-mail and
    > fire it out (no problem). The problem is, I want it to happen when a user
    > clicks a button.
    >
    > I've been using .NET for so long (this isn't a problem at all in .NET
    > obviously)...that I've forgotten how to handle this. Am I going to need a
    > second page to post an array of the file names to and then handle it there?
    > It just seems awfully redundant to need a second page to handle all of this,
    > but I guess it wouldn't shock me. It's been years since I've used classic
    > ASP, so bear with me =).
    >
    >
    David C. Holley, Jun 6, 2004
    #7
    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. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    470
    Raymond Hettinger
    Jul 27, 2003
  2. aghazalp

    very very basic question

    aghazalp, Apr 2, 2006, in forum: Python
    Replies:
    6
    Views:
    342
    aghazalp
    Apr 2, 2006
  3. shanx__=|;-

    very very very long integer

    shanx__=|;-, Oct 16, 2004, in forum: C Programming
    Replies:
    19
    Views:
    1,615
    Merrill & Michele
    Oct 19, 2004
  4. Peter

    Very very very basic question

    Peter, Feb 8, 2005, in forum: C Programming
    Replies:
    14
    Views:
    512
    Dave Thompson
    Feb 14, 2005
  5. mdh

    A very **very** basic question

    mdh, Sep 25, 2008, in forum: C Programming
    Replies:
    57
    Views:
    1,227
    August Karlstrom
    Sep 26, 2008
Loading...

Share This Page