Why is this consider bad practice? or is it? (ASP.Net)

Posted by user318573 on Stack Overflow See other posts from Stack Overflow or by user318573
Published on 2010-05-17T21:32:56Z Indexed on 2010/05/18 3:50 UTC
Read the original article Hit count: 138

Filed under:

Would this code be considered bad practice:

<div id="sidebar">
  <% =DisplayMeetings(12)  %>
</div>

This is a snippet of code from the default.aspx of a small web app I have worked on. It works perfectly well, runs very fast, but as always, I am aware of the fact that just because it works, doesn't mean it is OK.

Basically, the DisplayMeetings subroutine outputs a bunch of formatted HTML (an unordered list actually), with no formatting, just the requisite html, and then my CSS performs all the necessary formatting.

The data for generating the list comes from an SQL server database (the parameter controls how many rows to return) and I am using stored procedures and datareader for fast access. This keeps my front-end extraordinary simple and clean, imho, and lets me do all the work in VB or C# in a separate module.

I could of course use a databound repeater (and probably 6 or more other methods) of accomplishing the same thing, but are they any better? Other than loosing the design-time features of VS2010?

© Stack Overflow or respective owner

Related posts about ASP.NET