Hi,
I have used the following code, but instead of just one cell , all cells of
the column are filled with the image.
Private Sub dgMaand_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
dgMaand.ItemDataBound
Dim FilePath As String
FilePath = Request.PhysicalApplicationPath
Dim columnnaam As String = "01"
Dim img As New Image
img.ImageUrl = FilePath + "\blok_groen.jpg"
DataBinder.Eval(e.Item.DataItem, columnnaam)
e.Item.Cells(5).RowSpan = 1
e.Item.Cells(5).ToolTip = "test"
e.Item.Cells(5).Controls.Add(img)
End Sub
So, how can I just fill one cell with the image?
rg,
Eric
"Mirko Geffken" <mirkogeffken@oddpost.com> schreef in bericht
news:O5xXlTfPEHA.3348@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view] > I am replying to this by memory:
>
> You have two options
>
> 1) In the OnItemDataBound event simply grab a reference to the cell
> (somthing like e.item.Cells[2] and add an image to the control collection
> Image img=new Image();
> img.ImageUrl="/images/" +
> DataBinder.Eval(e.Item.DataItem,"MyImageColumnName");
> e.item.Cells[2].Controls.Add(img);
>
> 2) Simply add a templated column and set the ImageUrl property of an
> <asp:image tag to something like
> <%#DataBinder.Eval(Container.DataItem,"MyImageColumnName")%>
>
> Hope this helps
>
> Mirko
>
> "EMW" <SomeOne@MicroSoftdotCom> wrote in message
> news:40abd802$0$41747$5fc3050@dreader2.news.tiscali.nl...
> > For my ASP.NET program I want to use the datagrid as a sort of planning
> > tool.
> > Based on the information in a XML file, a cell of the datagrid must show
> an
> > image...
> >
> > Well, this is what I would like it to do, but is it possible and how can
I
> > place an image in
> > a web-datagrid cell?
> >
> > rg,
> > Eric
> >
> >
>
>