Now ASP. NET provides 3 controls to display a list of data
1.Repeater 2.DataList 3.GridView
These 3 controls are different
But I chose the Repeater control, because he can control the HTML output very flexibly
So that we can write our own DIV or UL Li, etc. can achieve WEB2.0 standard Web page
The Repeater control includes 4 common templates
1. HeaderTemplate
2. ItemTemplate
3. Altertemplate
4. FooterTemplate
In general, the part that does not circulate is written in HeaderTemplate and FooterTemplate.
Let's talk about the code in ItemTemplate.
<ul>
<li><%# ((Mycs.Model.CategoryInfo) Container.DataItem). Id.tostring ()%
></li>
</ul>
I recommend using this data bonding method because if we use the eval () method, he actually uses the reflex technique.
Reflection technology reduces the execution speed of a program, and must pass a parameter, and we usually use a data table field
This increases the coupling of the program, and if we use the above code we can use the entity object directly to
Go to the state set the birds with each other why not? Oh
Besides, DataSource's bonding.
I recommend using the list<t> generics one because it's type safe, faster. Two is the object directly inside the entity object
No multiple data conversions are necessary.