Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Very Basic Question

Reply
Thread Tools

Very Basic Question

 
 
James Baker
Guest
Posts: n/a
 
      06-04-2004
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 =).


 
Reply With Quote
 
 
 
 
Manohar Kamath [MVP]
Guest
Posts: n/a
 
      06-04-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 =).
>
>



 
Reply With Quote
 
 
 
 
James Baker
Guest
Posts: n/a
 
      06-04-2004
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


 
Reply With Quote
 
James Baker
Guest
Posts: n/a
 
      06-04-2004
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


 
Reply With Quote
 
Manohar Kamath [MVP]
Guest
Posts: n/a
 
      06-04-2004
That's correct... leaving action attribute empty lets the page post to
itself.

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


"James Baker" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Paul Baker [MVP, Windows - SDK]
Guest
Posts: n/a
 
      06-04-2004
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
David C. Holley
Guest
Posts: n/a
 
      06-06-2004
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 =).
>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I found some very odd behaviour in Python's very basic types Sunjay Varma Python 4 03-10-2011 05:05 PM
A very **very** basic question mdh C Programming 57 09-26-2008 03:25 PM
very very basic question aghazalp Python 6 04-02-2006 09:35 PM
Very very very basic question Peter C Programming 14 02-14-2005 09:46 AM
very Very VERY dumb Question About The new Set( ) 's Raymond Arthur St. Marie II of III Python 4 07-27-2003 12:09 AM



Advertisments