468,249 Members | 1,492 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,249 developers. It's quick & easy.

Modify Datalist standard itemtemplate output

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
Nov 19 '05 #1
5 3640
Isn't there the possibility to replace your table by <div> tags?

On 2004-12-04 10:49:56 -0300, Martman <on*******@nospam.com> said:
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: ma*****@centraldev.net
Tel: (54-11) 4856-3076
Móvil: (54-11) 15-5388-8068
Web: www.centraldev.net

Nov 19 '05 #2
Marcelo Hernán Ruiz wrote:
Isn't there the possibility to replace your table by <div> tags?

On 2004-12-04 10:49:56 -0300, Martman <on*******@nospam.com> said:
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


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.
Nov 19 '05 #3
And what about the Repeater control? It has almost the same
functionality of the DataList, but uses no tables.

On 2004-12-04 12:03:55 -0300, Martman <on*******@nospam.com> said:
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.


--

Marcelo Hernán Ruiz
--------------------------------------------------
Centraldev.net
Diseño, Desarrollo y Consultoría Tecnológica
Web: www.centraldev.net

Nov 19 '05 #4
This may be of help / interest

http://support.microsoft.com/default...b;EN-US;823030

Cheers, Pete

"Marcelo Hernán Ruiz" <ma*****@centraldev.net> wrote in message
news:2004120412305551872%marcelo@centraldevnet...
And what about the Repeater control? It has almost the same
functionality of the DataList, but uses no tables.

On 2004-12-04 12:03:55 -0300, Martman <on*******@nospam.com> said:
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.


--

Marcelo Hernán Ruiz
--------------------------------------------------
Centraldev.net
Diseño, Desarrollo y Consultoría Tecnológica
Web: www.centraldev.net

Nov 19 '05 #5
Marcelo Hernán Ruiz wrote:
And what about the Repeater control? It has almost the same
functionality of the DataList, but uses no tables.

On 2004-12-04 12:03:55 -0300, Martman <on*******@nospam.com> said:
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.


The repeater control does not have some of the functionality of the
datalist control such as the DataKeyField property.
Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by IGotYourDotNet | last post: by
8 posts views Thread by bienwell | last post: by
5 posts views Thread by Ben Fidge | last post: by
6 posts views Thread by Paul | last post: by
3 posts views Thread by Mirek Endys | last post: by
1 post views Thread by AJ | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.