H
Homer J. Simpson
I feel I'm not doing things correctly.
I have a <aspataList> embedded in a <aspanel> with its ScrollBars
property set to Auto. Essentially, I want to format a bunch of records as a
list in an area of the screen with a fixed size, so I want a scrollbar to
appear if I have a lot of records. That works fine.
Each row in my list consists of three fields that come from a database: a
date, a title (both on the same line), and followed by a longer description
below that first line. Knowing that the rendered HTML contains leading
table, tr and td tags, I've added my own tags right into the <ItemTemplate>:
<aspataList DataSourceID="..." >
<ItemTemplate>
<div class="clsDate"><%# Eval("MYDATE") %></div></td>
<td><div class="clsTitle"><%# Eval( "MYTITLE") %></div></td>
</tr>
<tr>
<td colspan="2"><div class="clsDescription"><%# Eval(
"MYDESCRIPTION" ) %></div>
</ItemTemplate>
</aspataList>
This lines up nicely:
Date1 Title1
Description1
Date2 Title2
Description2
Date3 Title3
Description3
The rendered output is exactly what I want (and perfectly valid HTML)...but
I can't help but get the feeling that I'm "cheating" by embedding my own
partial tags--eg, my first <td> tag is a terminating </td>, knowing that the
framework will already have generated a leading <td> by then, and I don't
supply a terminating </td> either, knowing the framework will generate the
final </td> tag...
As far as I understand them, the DetailsView and FormView controls offer
more layout flexibility, but are are intended for displaying a single record
at a time.
Is my approach a common and acceptable ASP.NET 2.0 practice? If it is, then
so be and I'm worrying about nothing because "it works" and the rendered
code is clean...but as much as possible, I'd like to do things the way
you're supposed to and not hack partial tags into .aspx files (not to
mention that it'll probably trip the WYSIWYG editor sooner or later)...
I've seen more than a few references suggesting that the DataList has been
mostly replaced by the GridView, but as far as I can tell, this isn't going
to work in this case because I want the description to appear on its own row
after the date and title fields (whereas the GridView is strictly
line-oriented).
Thoughts?
I have a <aspataList> embedded in a <aspanel> with its ScrollBars
property set to Auto. Essentially, I want to format a bunch of records as a
list in an area of the screen with a fixed size, so I want a scrollbar to
appear if I have a lot of records. That works fine.
Each row in my list consists of three fields that come from a database: a
date, a title (both on the same line), and followed by a longer description
below that first line. Knowing that the rendered HTML contains leading
table, tr and td tags, I've added my own tags right into the <ItemTemplate>:
<aspataList DataSourceID="..." >
<ItemTemplate>
<div class="clsDate"><%# Eval("MYDATE") %></div></td>
<td><div class="clsTitle"><%# Eval( "MYTITLE") %></div></td>
</tr>
<tr>
<td colspan="2"><div class="clsDescription"><%# Eval(
"MYDESCRIPTION" ) %></div>
</ItemTemplate>
</aspataList>
This lines up nicely:
Date1 Title1
Description1
Date2 Title2
Description2
Date3 Title3
Description3
The rendered output is exactly what I want (and perfectly valid HTML)...but
I can't help but get the feeling that I'm "cheating" by embedding my own
partial tags--eg, my first <td> tag is a terminating </td>, knowing that the
framework will already have generated a leading <td> by then, and I don't
supply a terminating </td> either, knowing the framework will generate the
final </td> tag...
As far as I understand them, the DetailsView and FormView controls offer
more layout flexibility, but are are intended for displaying a single record
at a time.
Is my approach a common and acceptable ASP.NET 2.0 practice? If it is, then
so be and I'm worrying about nothing because "it works" and the rendered
code is clean...but as much as possible, I'd like to do things the way
you're supposed to and not hack partial tags into .aspx files (not to
mention that it'll probably trip the WYSIWYG editor sooner or later)...
I've seen more than a few references suggesting that the DataList has been
mostly replaced by the GridView, but as far as I can tell, this isn't going
to work in this case because I want the description to appear on its own row
after the date and title fields (whereas the GridView is strictly
line-oriented).
Thoughts?