Showing posts with label convert. Show all posts
Showing posts with label convert. Show all posts

Tuesday, September 22, 2009

Convert HTML Form Elements to ASP.NET form elements

Here is my quick method for converting an HTML page to an ASPX page, handling the controls.
1. First I am going to add runat = "server" to the Form tag. I am also going to remove any function calls that were there previously since I will be replacing it with .NET code. I am removing the action and onsubmit elements from the tag.

Transform to


2. Next I am going to find all the text boxes:

Find
Replace with

If your tags are not arranged with the name following "text" you may need to modify it manually or be more specific with your find/replace

If you are closing the input tag, you will need to manually replace it with a closing
tag. Be careful because there are multiple types of inputs in your form, you do not want to replace all of them.
3. Next, I do the same find and replace with the submit button:

to
runat = "server" ID=
4. Translate your submit action into .NET code behind



EDIT:
The copy and pasting of HTML screwed up the entry I made. I will fix it later.