0

I have been editing one html template in Microsoft Expression web 4,and right now I wish to bring all I have done into Visual Studio in order to start coding on it.

But when I copy everything into a webpage in Asp.net some parts of my template will change,I could fix it some how,but when I put a <form> tag at the begining of the <body> tag then the headr of my template will have some bad changes.

Please help if you know how can I solve this problem.

2
Contributors
12
Replies
13
Views
4 Years
Discussion Span
Last Post by b.shafabakhsh
0

You should be able to copy your HTML markup and asp.net controls. It sounds to me like you may have not copied over the style sheet over to the visual studio project.

0

Hi Jorge.
I have been transfering all the CSS as well,in fact everything is working very well till i put the <form> tag after the <body> tag in order to use Asp.net tools,and one I plce it I can see a wrong output in my header.

0

I would have to take a look at your example. Adding the form control is needed if you plan on adding other controls that depend on form submission.

0

Jorge I'm really thankful.I will be happy to show you the example,just may I have your Email address so I can send you over the example?

0

Generally, we interface over this forum. The purpose here is not only to help you but others that may have a similar problem. With regard to code, if its not too much, you can add it within a post, or you should be able to zip it and upload it. Or if its just HTML and CSS, you would be able to use a site like jsfiddle.

0

Thanks for your advice,I'm very new with here which is why I didn't know much about here.
However I have uploaded the zip file of my work.It's very simple it has only one HTML page and three CSS together with antother folder wich consist of images.
As I said once I open the template in Visual studio everything is allright untill I add the <form runat="server"> after <body>.
file link is: http://www.mediafire.com/?eqnqdtt0oxedj2c
Thank you very much for your help.I really appreciate.
Regards
"Benjamin"

0

Ok so what comes to mind when looking at your code is why you are adding the form element after the body? In the case of the form control with the attribute "runat", that would indicated that you want to have this form available and processed by the asp.net engine (I assume). However, this file is saved as a .htm so the asp.net engine would not process the file.

Secondly, if you enclose all of your elements within this "form" element just after the body, you are running into the issue that you have ther form elements on the page. You cannot have form elements nested within other form elements. so this is why you are running into the issue you are experiencing. Any element that you add "runat" as an attribute will be processed server side and this requires the aspx file extension.

Edited by JorgeM

0

The reason I'm adding <from runat="server"> and i'm closeing it just before </body> is because I wanat use some Asp.net tools such as button,and If I don't place this tag I'm not able to use Asp.net tools,isn't it?

0

That's fine but you cant have form elements within other form elements. I'd remove the other form elements on the page, but before you do so you really need to have a plan. Make a copy of that page before you proceed.

0

Thanks jorge for your helpful info,when you removed the other form could it solve the problem that I'm faceing which will occur when you place Asp.net form?(I mean the header part)
Thanks and merry christmast.

Edited by b.shafabakhsh: wrong spelling

0

Im not an asp.net pro by any stretch of the imagination. however, usually when I develop aspx pages, I only have one form element. I could still have many input type elements, several buttons, etc.. I handle the click events on the server side (code behind). However, If if more than one form element is needed, have them adjacent to each other. So in your example, if you require more than one form, you can do so, but do not wrap all of the elements within the asp.net form control.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.