Hi Waghmare,
I have created sample code which fullfill requirement.
HTML
<div>
<asp:GridView ID="gvEmployees" runat="server" AutoGenerateColumns="false" OnRowDataBound="gvEmployees_RowDataBound">
<Columns>
<asp:BoundField DataField="EmployeeId" HeaderText="EmployeeId" />
<asp:BoundField DataField="EmployeeName" HeaderText="EmployeeName" />
<asp:TemplateField HeaderText="Pics">
<ItemTemplate>
<asp:Image ID="empimage" Height="50px" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.Add("EmployeeId", typeof(int));
dt.Columns.Add("EmployeeName", typeof(string));
dt.Rows.Add(1, "peter");
dt.Rows.Add(2, "John");
dt.Rows.Add(18, "Janet");
dt.Rows.Add(101, "Margaret");
dt.Rows.Add(1001, "Steven");
dt.Rows.Add(10001, "Michael");
gvEmployees.DataSource = dt;
gvEmployees.DataBind();
}
}
protected void gvEmployees_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string EmployeeId = e.Row.Cells[0].Text;
(e.Row.FindControl("empimage") as Image).ImageUrl = "~/Files/" + "00000000".Substring(EmployeeId.Length, 8 - EmployeeId.Length) + EmployeeId + ".jpg";
}
}
Screenshot
I hope works for you.