Generate div box based on database rows
I want to generate div box dynamically based on database row. For example, if sql query retrieves 3 ids then 3 div box should appear one after another. I'm not开发者_C百科 getting logic to implement this.
I'll appreciate your any reply....
Thanks
Use the Repeater control, which can be customized entirely and you can databind it to an SqlDataSource control.
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="FooSqlDataSource">
<HeaderTemplate><!-- header content --></HeaderTemplate>
<ItemTemplate>
<div><!-- content --></div>
</ItemTemplate>
<SeparatorTemplate><!-- separating content --></SeparatorTemplate>
<AlternatingItemTemplate><!-- alternatig content --></AlternatingItemTemplate>
<FooterTemplate><!-- footer content --></FooterTemplate>
</asp:Repeater>
精彩评论