December 7th, 2012, 06:41 PM
can't add images to GridView
I have a DataGrid web control on my ASPX page. It has a column (titled "Active") that set to ImageField.
In my code, I'm trying to set the content the cells in this column to an image. It's not working. I'm doing this:
Nothing shows up under the Active column.
System.Web.UI.WebControls.Image checkMarkImage = new System.Web.UI.WebControls.Image();
checkMarkImage.ImageUrl = "C:\\CoreDataProject\\MAIN\\src\\ProjectApp\\ProjectApp\\images\\checkmark.gif";
DataTable myTable = new DataTable();
DataRow row = myTable.NewRow();
row["Active"] = checkMarkImage;
UserGrid.DataSource = myTable; // UserGrid is the asp:GridView
Can anyone see what I'm doing wrong?
December 7th, 2012, 10:20 PM
Re: can't add images to GridView
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
Click Here to Expand Forum to Full Width