hi skand pratal singh,
Please see below code.it will solve your problem. i have implemented it:
.aspx code:
<asp:Repeater ID="rpt" runat="server" OnItemDataBound="rpt_ItemDataBound">
<ItemTemplate>
<table>
<tr>
<td>
<asp:Image ID="img" runat="server" ImageUrl='<%#"~/images/"+Eval("Image") %>' Width="160px" Height="169px"/>
</td>
<td>
<table>
<tr>
<td>
Name :
</td>
<td>
<asp:Label ID="lblname" runat="server" Text='<%#Eval("Firstname") %>'></asp:Label></td>
</tr>
<tr>
<td>
Mobile :
</td>
<td>
<asp:Label ID="lblmobile" runat="server" Text='<%#Eval("Mobile") %>'></asp:Label></td>
</tr>
<tr>
<td>
Salary :
</td>
<td>
<asp:Label ID="lblsalary" runat="server" Text='<%#Eval("Salary") %>'></asp:Label></td>
</tr>
<tr>
<td>
Sex :
</td>
<td>
<asp:Label ID="lblsex" runat="server" Text='<%#Eval("Sex") %>'></asp:Label></td>
</tr>
</table>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
.aspx.cs code:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default3 : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Demo"]);
protected void Page_Load(object sender, EventArgs e)
{
bindRepeater();
}
private void bindRepeater()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from contact", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
rpt.DataSource = dt;
rpt.DataBind();
}
con.Close();
}
}