I am trying to use a datatable as a radgrid source and display an image in the cell. I have followed this example (Displaying Images in a GridView Column), but it just displays the URL string instead of the image. In searching for a solution many people have this same problem. I have tried other things, but they too do not work.
If I use RadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) and the first code section below it works. Unfortunately that brings up another problem. I also use ToggleRowSelection(object sender, EventArgs e) and this removes the image when it is called. I could possibly call RadGrid_ItemDataBound from ToggleRowSelection, but one has EventArgs and the other has Telerik.Web.UI.GridItemEventArgs and casting does not work. There may be a better way to get RadGrid_ItemDataBound to fire after ToggleRowSelection, but I would like to be able to put the image in initially if possible.
RadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)...
Image imgTrue = new Image();imgTrue.ImageUrl = "images/true.png";item["Picture"].Controls.Add(imgTrue);
Here is my code from the linked example. images/false.png appears instead on the image.
DataTable oDT = new DataTable();//oDT.Columns.Add("Picture");oDT.Columns.Add(New DataColumn("Picture", GetType(String));DataRow myRow = oDT.NewRow();myRow["Picture"].ResolveUrl("images/false.png");oDT.Rows.Add(myRow);DataSet MyDataSet1 = new DataSet("pic");MyDataSet1.Tables.Add(oDT); RadGrid1.DataSource = MyDataSet1;RadGrid1.DataBind();