can't add images to GridView
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 2 of 2

Thread: can't add images to GridView

  1. #1
    Join Date
    Nov 2011

    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.

    Name:  DataGrid.png
Views: 124
Size:  80.4 KB

    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:

    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;
    UserGrid.DataSource = myTable; // UserGrid is the asp:GridView
    Nothing shows up under the Active column.

    Can anyone see what I'm doing wrong?

  2. #2
    Join Date
    Feb 2011
    United States

    Re: can't add images to GridView

    Best Regards,

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)