ASP.NET Guestbook - Explanation of the Tags (Page 8 of 8 )
<ItemTemplate>
This tag wraps the HTML controls for each row in the data source.
<Header/Footer Template>
These templates are used to render controls and text at the beginning and end of the list. We have coded <table> in the Header template and </table> in the footer template so that all the rows get contained within a single table.
<AlternatingTemplate>
Same as ItemTemplate but used to distinguish every alternating row by means of different color, fonts, etc., In our app we used different color.
<SeparatorTemplate>
Control to render between each DataRow.In our case it’s an <HR>tag
There many other templates for you to consider as you get more comfortable with them.
If everything goes right you might see the guestbook like this:

Things to consider in future editions
You may wish to validate the email ID of Viewcomments.aspx as well as implement a paging mechanism with the datalist.
Resource Links:
Connecting to DataBase
Info about Datalist
Datalist Paging
MSDN library
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |