<asp:Repeater runat="server" ID="rptblogs"> <ItemTemplate> <h1><%#Eval("Name") %></h1> <p><%#Eval("Description") %></p> <p><a href="<%#Eval("Link") %>"></a></p> </ItemTemplate> </asp:Repeater>
using (SqlConnection con = new SqlConnection("connection_string")) { using (SqlCommand cmd = new SqlCommand("select * from blogs", con)) { cmd.CommandType = CommandType.Text; using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { using (DataTable dt = new DataTable()) { sda.Fill(dt); rptblogs.DataSource = dt; rptblogs.DataBind(); } } } }
Post Comments(0)