ASP to ASP.NET V

Making a ASP.NET Contact Form

Our original Contact Form was based on the standard ASP spaghetti code posting back to itself and using the ASPMail component.

This was definitley one of those instances where I got tired of reading pretty quickly. It seems there are many, many options when creating forms, checkboxes, and emails with .NET

I read these two simple articles and sample files and went about rewriting this page pretty quickly, using some of the knowledge I had already picked up in the previous articles.

CheckBoxList Web Server Control

How to send an email in ASP.net

The second article there was simply this easy ASP.NET Email script

While this was useful, it didn't answer all my issues, just got me started. I also picked up that I didn't have to use the StringBuilder Class in order to build up a string as I had thought before. This time I simply used

So in essense my previous example of how to build a string could now also be

This made a lot more sense to me

Not sure if i used all the proper techniques here, but I essentially put the entire form inside <asp:label ID=contactForm></asp:label>

Then a Thank You Message in another label tag.

the "If.IsPostBack" means "If the user has posted"... I think you'll get the rest

Anyways here's the code I ended up with

And here's a cleaner copy of almost the same thing, but with less emphasis on design and fewer fields


Comments


Leave a Comment

 

 







LATEST POSTS

PostBackUrl Equals Change the Friggin' Form Action . Curse you DBNull and/or Is Nothing! . Career Developers are Shitbags they are. Consolas Makes Me Geek-ier MS Consolas Font Abuse Things I Read Today and You Should Too Whilst searching for solutions I happened upon...

ADS

MOST POPULAR

Multiple IEs in Windows Date Image Thing Firefox Vs. The World Who Is Xperya? ActionScript Form Fields Quick Watermark IE 7 beta 2 standalone

IP Address Tool Chicago Web Design Free Text Messaging