开发者

VB.NET ASP.NET Web Application woes (VS 2008)

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 iss开发者_StackOverflow社区ue 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?


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:

  • you give up a lot control of your markup (although this will actually be getting better in 2010, with more sane control-generated markup and controllable id attributes.)
  • debugging can be difficult, since you can't fix a bug in the controls themselves. It's often difficult to find what is actually causing your bug.
  • what actually goes down to the browser can be huge, with a lot of extra markup that you didn't intend, don't need, and don't about until you "view source" on the client.

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.


Please check out the Getting Started Videos for getting into ASP .Net. To layout your form it is the same with HTML. You may have to put Divs, Tables or such and to make it more presentable you should use CSS. ASP .Net has a great deal of features like Masterpages and controls like GridViews, Listviews etc. to make development of web pages simple.

HTH

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜