Geeks With Blogs
Phil Sando

Here is the markup for the repeater control and its templates:

<asp:Repeater ID="Repeater" runat="server">
<HeaderTemplate>
<table>
<tr>
<td colspan="3"><h2>Header information:</h2></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#Container.DataItem%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

 Here is the code to populate it with data:

  SQLString = "select something from foo where something"
            SQLCommand = New SqlCommand(SQLString, SQLConnection)
            SQLConnection.Open()
            SQLDReader = SQLCommand.ExecuteReader
            If SQLDReader.HasRows Then
                Contactinforepeater.DataSource = SQLDReader
                Contactinforepeater.DataBind()
            End If
        End If
        SQLConnection.Close()
        SQLDReader.Close()

Posted on Thursday, April 22, 2010 9:56 AM | Back to top


Comments on this post: ASP.net repeater control with SQLDataReader as data source

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © PhilSando | Powered by: GeeksWithBlogs.net