Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 31st, 2008, 10:54 AM
Friend of Wrox
 
Join Date: May 2005
Location: , , Norway.
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default Postback

Hei!

Relative to VB-Script (ASP 3.0), with what can I compare the PostBack-function?

Mvh
grstad
__________________
Internet has become favorable with that tool...thank you Tim Berners-Lee!
  #2 (permalink)  
Old May 31st, 2008, 09:41 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

In the days of ASP/VBscript I would use a model similar to the ASP.NET postback model. The form action value would always be the same page that generated the form (giving you post*back*). In order to determine what actually triggered the postback I would test the form collection for each submit input's value. By nature of how HTML forms work, only the submit input (button or image) that you actually clicked on would submit a value, others would be left blank. Therefore it was simple to determine the control that triggered the post by checking each against an empty value with code like this:

   If Request.Form("btnSubscribe") <> "" Then
      'Do subscribe logic here
   ElseIf Request.Form("btnSearch") <> "" Then
      'Do search logic here
   End If

This is basically what the ASP.NET runtime is doing under the covers. It is translating that into a control event for the button. You then handle that button event on the page as the button click handler method.

Now this is the case with simple image or button inputs. Basically every other type of postback trigger (link buttons, DDL selection changes, textbox onChange [which is really onBlur], etc) are hooked up to the __doPostback() method that ASP.NET emits to the page.

-Peter
compiledthoughts.com
  #3 (permalink)  
Old June 1st, 2008, 03:48 PM
Friend of Wrox
 
Join Date: May 2005
Location: , , Norway.
Posts: 189
Thanks: 0
Thanked 0 Times in 0 Posts
Default

...thank you for the detailed answer.

Mvh
grstad
  #4 (permalink)  
Old June 13th, 2008, 07:56 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

I have been sitting on this thread for about 2 weeks now! grstad, you may be interested in the new Blox article Jumping from ASP to ASP.NET which I authored and Peter did the editing work on as it introduces you to ASP.NET by showing you a snippet of Classic ASP code and then shows the equivalent ASP.NET code. Being that it is a Blox article it only covers the basics such as handling postbacks and maintaing form state, working with databases, sending email etc.

You can find the Blox article here:
http://www.wrox.com/WileyCDA/WroxTit...470391847.html

hth.
-Doug

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========


Similar Threads
Thread Thread Starter Forum Replies Last Post
Postback other page Snuffles ASP.NET 2.0 Basics 1 July 7th, 2007 12:46 AM
postback sameer_1981 ASP.NET 1.0 and 1.1 Basics 1 February 23rd, 2007 09:36 AM
Postback raulsormus Classic ASP Basics 0 February 22nd, 2005 09:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.