Aspx code source
<asp:Repeater ID="repearter" runat="server">
<ItemTemplate>
Title : <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Title") %>'></asp:Label> <br>
Description : <asp:Label ID="lblDiscription" runat="server" Text='<%# Eval("Description") %>'></asp:Label>
</ItemTemplate>
</asp:Repeater>
c# code
protected void bindRepeater()
{
try
{
con.Open();
cmd = new SqlCommand("select * from tbl_AddNews Order by Date desc",con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
repearter.DataSource = ds;
repearter.DataBind();
con.Close();
}
catch (Exception ex)
{
}
}
<asp:Repeater ID="repearter" runat="server">
<ItemTemplate>
Title : <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Title") %>'></asp:Label> <br>
Description : <asp:Label ID="lblDiscription" runat="server" Text='<%# Eval("Description") %>'></asp:Label>
</ItemTemplate>
</asp:Repeater>
c# code
protected void bindRepeater()
{
try
{
con.Open();
cmd = new SqlCommand("select * from tbl_AddNews Order by Date desc",con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
repearter.DataSource = ds;
repearter.DataBind();
con.Close();
}
catch (Exception ex)
{
}
}
No comments:
Post a Comment