I am making my first web application with ASP.NET and I am having a rough time. I have previously created the application I am working on as a Windows Form application and it works great, but I am having problems with the HTML side of things in the web application. My issues are pretty minor, but very annoying. I have worked with websites before and CSS, but as far as I can tell I do not have direct access to a CSS when creating a web application in VS 2008. My biggest issue is the positioning of components that I have dragged onto the “Default.aspx” form. For instance, how am I supposed to float a panel next to another one if I don’t have a CSS, or how am I to correctly position a label?
Share
You have a bit of a problem, if you want fine-grained (aka adequate) control over your css and markup. The Web-forms model was intended to “shield” you from these issues. Web forms and web controls can be very powerful in their ability to quickly deploy solutions, but there are some challenges:
If you have not already investigated it, consider the ASP.NET MVP framework. We can now say that you have two main options when delivering web solutions with .NET, ASP.NET Webforms, and ASP.NET MVC. The MVC framework drops support for web controls, and helps you deliver your solution using the MVC pattern. This means several things, but for you it means a framework that assumes you want to define the layout yourself, and know the html going down to the browser.
Note that even in “classic” ASP.NET webforms (the type of project you’ve started with), you can still have control of your markup. If your .aspx page, just manually put the css and html that you want to have there. Using ASP “controls” is what really takes you away form your markup (and indirectly, from your CSS). A webforms project can have a great, efficient structure, but you have to provide it yourself.