Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: content of empty textbox when posted


Message #1 by gary@e... on Fri, 23 Aug 2002 02:26:44
Hi,
  When an empty textbox is posted what are the contents the receiving page 
gets from it, if not "" or null?. This is about c# exclusively. If you do 
know the answer please advise. Thank you.

Gary
Message #2 by "John Atkinson" <d.j.s.atkinson@b...> on Sun, 25 Aug 2002 17:28:56
What I usually get is an Exception is thrown - because the place the data 
is going to is expecting a string, and it doesnt get it. The way to deal 
with it is to catch the exception.

Hope this helps.
Message #3 by gary@e... on Wed, 28 Aug 2002 03:57:23
Hi John Atkinson

  Using Request.Form["text2"].GetType() I found out that submitting an 
empty textbox sends a system string. Thinking that it must be an empty 
string I used this:

  if(Request.Form["text1"] != null && Request.Form["text1"] != "")

  The null worked the first time the page opened and the "" part worked 
when the empty textbox was submitted. Once a textbox was filled and 
submitted the asp on the server remembered the content and sent it with 
the message even if the textbox was now empty.

Gary

  Return to Index