Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't add images to GridView

Status
Not open for further replies.

gib99

Programmer
Mar 23, 2012
51
CA
Hello,

I have a DataGrid web control on my ASPX page. It has a column (titled "Active") that set to ImageField.

attachment.php


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:

Code:
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();

...

myTable.Columns.Add("Active", typeof(System.Web.UI.WebControl.Image));

...

DataRow row = myTable.NewRow();

...

row["Active"] = checkMarkImage;
myTable.Rows.Add(row);

...

UserGrid.DataSource = myTable; // UserGrid is the asp:GridView
UserGrid.DataBind();

Nothing shows up under the Active column.

Can anyone see what I'm doing wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top