asp.net from html

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

A client has provided an html sample page to be used as "template" for an
asp.net enquiry form to maintain their intended look and feel. Info from the
asp.net form is to be emailed on submission of form. I am not sure how to go
from here in transition from an html layout to a page which incorporates
enquiry form elements in asp.net. Do I need to convert the html page into a
web form? How? Something else I should rather do?

Some elaboration would be appreciated, I am a complete newbie to asp.net and
have only just started switching from asp.

Thanks

Regards
 
Hi John:

I don't think there is a set formula you can go through, but if you
are going to work in asp.net the plan should be to convert the
controls on the HTML page into server side controls. Create a new web
form in VisualStudio .NET. Move the HTML page into the form by copying
over pieces of the HTML or modifying the form (i.e. copy over any
<link> tags, styles, and <table> elements).

The important step is to convert to server side controls. An input
type = "text" becomes an <asp:TextBox>, an input button becomes an
<asp:Button>.

You will want to read some introductory material on ASP.NET first if
you have not done any asp.net forms development. Here is one tutorial:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/introwebforms.asp

There are plenty more you can find with Google.

HTH,
 
You're on the right track. ASP.NET is built on webforms.

Here's a good intro to webforms if you're just getting started:
http://www.dotnetjunkies.com/quickstart/aspplus/doc/webformsintro.aspx

There are a few ways to get the HTML onto a new webform. If you're
using Visual Studio.NET, the easiest way is to Copy / Paste it in:
1. Create a new ASP.NET project in Visual Studio.NET
2. Open the HTML page in your browser
3. Copy the page to the clipboard: Edit / Select All, then Edit / Copy
4. View your webform (Webform1.aspx is the default name) in design mode
5. Right-click on the empty form and select Paste.

If you don't have Visual Studio, I suggest you download WebMatrix:
http://www.asp.net/webmatrix/default.aspx?tabIndex=4&tabId=46

You can probably use the Copy / Paste approach there, too.

Once your HTML is in a webform, you're ready to get started on
conversion to ASP.NET controls. You don't have to, but it makes things
easier. For instance, you'd change HTML <input type=text> to
<asp:textbox>. You can also just right-click on form elements and
select "Run as server control".

Once you've either changed the submit button to an <asp:Button> or
changed it to run as a server control, you can just double click on it
and write your submit code there. If you've worked with Visual Basic
before, it should seem very familiar.

This page has some good sample code for sending the results of a
webform post via e-mail:
http://www.developer.com/net/asp/article.php/3096831

Hope this helps get you started.

- Jon
http://weblogs.asp.net/jgalloway
 
Back
Top