Modify Datalist standard itemtemplate output

M

Martman

First here is my goal:

When a datalist is rendered to a page and you use the <itemtemplate> the
datalist automatically prints a <tr> <td> start and end tags. Now this
may not be too bad but I have run into a situation repeatedly with the
designing factor of a datalist.

Most of the time when I use a datalist I utilize the header, item, and
footer templates to build a custom table. However, utilizing the simple
example below you will see why this is a problem.

My datalist in code:

<headertemplate>
<table width="100%" summary="Table displays a list of info">
<tr>
<th scope="col"></th>
<tr>
</headertemplate>
<itemtemplate>
<tr>
<td scope="row"></td>
</tr>
</itemtemplate>
<footertemplate>
</table>
</footertemplate>


I have to build Section 508 compliant web pages for handicap
accessibility which .Net does not do very well. Now with the above
DataList the actual output would be like the following:

<table id="dlstMyDataList_skdis">
<tr>
<td>
<table width="100%" summary="Table displays a list of info">
<tr>
<th scope="col"></th>
<tr>
</td>
</tr>
<tr>
<td>
<tr>
<td scope="row"></td>
</tr>
</td>
</tr>
</table>
</table>

As you can see this is not a very well formed table and can cause
enormous problems with page layouts and 508 issues. Is there any way I
can override the way that .Net outputs the DataList object so that I can
effectively have a correctly designed table?

Thanks
Marty U
 
?

=?ISO-8859-1?Q?Marcelo_Hern=E1n_Ruiz?=

Isn't there the possibility to replace your table by <div> tags?

First here is my goal:

When a datalist is rendered to a page and you use the <itemtemplate>
the datalist automatically prints a <tr> <td> start and end tags. Now
this may not be too bad but I have run into a situation repeatedly with
the designing factor of a datalist.

Most of the time when I use a datalist I utilize the header, item, and
footer templates to build a custom table. However, utilizing the simple
example below you will see why this is a problem.

My datalist in code:

<headertemplate>
<table width="100%" summary="Table displays a list of info">
<tr>
<th scope="col"></th>
<tr>
</headertemplate>
<itemtemplate>
<tr>
<td scope="row"></td>
</tr>
</itemtemplate>
<footertemplate>
</table>
</footertemplate>


I have to build Section 508 compliant web pages for handicap
accessibility which .Net does not do very well. Now with the above
DataList the actual output would be like the following:

<table id="dlstMyDataList_skdis">
<tr>
<td>
<table width="100%" summary="Table displays a list of info">
<tr>
<th scope="col"></th>
<tr>
</td>
</tr>
<tr>
<td>
<tr>
<td scope="row"></td>
</tr>
</td>
</tr>
</table>
</table>

As you can see this is not a very well formed table and can cause
enormous problems with page layouts and 508 issues. Is there any way I
can override the way that .Net outputs the DataList object so that I
can effectively have a correctly designed table?

Thanks
Marty U


--

Marcelo Hernán Ruiz
--------------------------------------------------
Centraldev.net
Diseño, Desarrollo y Consultoría Tecnológica
Email: (e-mail address removed)
Tel: (54-11) 4856-3076
Móvil: (54-11) 15-5388-8068
Web: www.centraldev.net
 
M

Martman

Marcelo said:
Isn't there the possibility to replace your table by <div> tags?
Actually no, especially when the data is related data and must be
rendered to be 508 compliant. Hence the scope tags and actually those
are the cheaters way of making a list of data copliant. I have been
doing some research and think I can use the templatebuilder class but I
need to inherit the datalist control so I can have the functionality of
the databinding, methods, and properties but just have a custom output
so that when you add a datalist to the page it will only render a table
and no tr or td tags so I can embed my own header, footer and item
templates.

Can someone give me an idea of how I can create a composite control with
custom template items but inherit all the functionality of a datalist.

Thanks

Marty U.
 
?

=?ISO-8859-1?Q?Marcelo_Hern=E1n_Ruiz?=

And what about the Repeater control? It has almost the same
functionality of the DataList, but uses no tables.
 
M

Martman

Marcelo said:
And what about the Repeater control? It has almost the same
functionality of the DataList, but uses no tables.
The repeater control does not have some of the functionality of the
datalist control such as the DataKeyField property.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top