SPAM-LOW: [thelist] ASP.NET: testing an object for a value

Peter Brunone (EasyListBox.com) peter at easylistbox.com
Mon Mar 7 14:28:25 CST 2005


Hi Tom,

   FYI, that's VB.NET, not VBScript (aside from syntax, the two are very dissimilar).

   Are you thinking of the RequiredFieldValidator?  If so, you could use one like this:

<ASP:RequiredFieldValidator
  ControlToValidate="txtEmail"
  Display="Static"
  ErrorMessage="Required"
  runat=server />

Cheers,

Peter

 From: Tom Dell'Aringa pixelmech at yahoo.com

Hello again,

Still working on my form and have a question. I'm picking off the user's e-mail address from the
form like so (VB Script):

Dim objMM as New MailMessage()
objMM.From = txtEmail.Text

However,this is not required. But if they don't fill it in I get an error since the mail object (I
think) requires a sender.

How can I test objMM.From to see if it is blank, and if not supply a no-reply email like
(no-replay at somewhere.com) so the email fires off?

Also, I thought I saw somewhere there was a simple way to require fields in ASP.Net...

Thanks

Tom


More information about the thelist mailing list