Hi,
How can I add image into Gridview Databound dynamically using ASP.NET C#
I need to add an image icon to GridView databound at runtime in a specific cell.
I started code already but I’m not sure how to accomplish it because using this code the image don't showing in GridView.
See below:
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DataItem != null)
{
ImageButton image = new ImageButton();
image.ImageUrl = "C:/inetpub/wwwroot/img/add-page-red.gif";
e.Row.Cells[2].Controls.Add(image);
}
}
Any help would greatly appreciate.
Thank you.