Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Do you ever "post" forms using VB.NET (in response to ch. 3)?


Message #1 by "Darrel Austin" <darrelaustin@h...> on Fri, 19 Jul 2002 17:56:43
I finally found the new code that works with the last two examples in 
Chapter 3 of Beggining ASP.NET. Unfortunately, the correct code pretty 
much is the exact opposite of the concepts being talked about, so I'm a 
bit confused.

The book (based off of .net beta) uses the form attribute METHOD="POST" to 
pass data to the next page. However, that produced all sorts of errors 
when using the release version of asp.net. So, the code is fixed but no 
longer included the METHOD="POST" but instead uses a script with GETS and 
RETURNS on the form page, and some (cryptic, to me) VB on the second page 
that receives the data (it uses '<%@ ' tags and "Dim fp As FirstPageClass" 
scripts).

Can anyone explain, in broad terms, this seemingly important difference 
between the book/asp.net beta and the correct/final release code? Does one 
ever actually use METHOD="POST" with ASP.NET? If so, when?

Thanks!

-Darrel
Message #2 by planeswalk@h... on Wed, 24 Jul 2002 13:25:12
Hi Darrel,

First off, the POST method has already been made the default when using 
web forms in ASP.NET, so you won't have to declare it anymore. With 
regards to the code you saw, I don't have the book but could you paste 
some code here so we can all see?

Cheers!

Marlon




> I finally found the new code that works with the last two examples in 
C> hapter 3 of Beggining ASP.NET. Unfortunately, the correct code pretty 
m> uch is the exact opposite of the concepts being talked about, so I'm a 
b> it confused.

> The book (based off of .net beta) uses the form attribute METHOD="POST" 
to 
p> ass data to the next page. However, that produced all sorts of errors 
w> hen using the release version of asp.net. So, the code is fixed but no 
l> onger included the METHOD="POST" but instead uses a script with GETS 
and 
R> ETURNS on the form page, and some (cryptic, to me) VB on the second 
page 
t> hat receives the data (it uses '<%@ ' tags and "Dim fp As 
FirstPageClass" 
s> cripts).

> Can anyone explain, in broad terms, this seemingly important difference 
b> etween the book/asp.net beta and the correct/final release code? Does 
one 
e> ver actually use METHOD="POST" with ASP.NET? If so, when?

> Thanks!

> -Darrel
Message #3 by "Darrel Austin" <darrelaustin@h...> on Wed, 24 Jul 2002 16:17:32
> With 
> regards to the code you saw, I don't have the book but could you paste 
> some code here so we can all see?

Thanks for replying, Marlon.

The code in the book (for those that have it) is on page 126. It consists 
of two files, the form, and the page that receives the data.

The form page is your basic form with this following tag:

    <form action="holidayresponse.aspx" method="post">

The page that receives the data uses a simple Response.Write code to write 
the data received from the first page.

Sounds simple, and it was, obviously, in the beta version of .net, but the 
above causes all sorts of errors.

The 'fixed' code can be viewed here:

http://www.wrox.com/ACON16h1.asp?BookID=463

(scroll down to the two pages on page 126)

In summary the 'fixed' form pages uses a lot of code like this:

      Public ReadOnly Property FullName() As String
         Get
            Return name.Text
         End Get
      End Property

and the 'fixed' page that receives the data uses a lot of code like this:

        <%=fp.FullName%><br/>

The problem is that the eratta shows me the correct code, but in no way 
explains the concepts behind it. Which makes it VERY hard for someone 
completely new to all of this catch up in the book. (NOTE TO WROX: Fixing 
the code only provides half of the answer!)

Thanks for any insight into this!

-Darrel





  Return to Index