Images in DataTable VB

  • Thread starter _nabuchodonozor
  • Start date
N

_nabuchodonozor

Hi

I need to add column with IMAGE type to DataTable. I will have some
URLs which store images. The DataTable will be the DataSource to my
DataList. And I need to display somehow those pictures from URLs. I
tried to do this but there is no ImageTpye for columns. I don't know
how to do this...

Nabu
 
N

_nabuchodonozor

I will put here some code to explain better want I want to achieve.

dlComments = new DataList()
dt = New DataTable()

column = New DataColumn()
column.ColumnName = "UserAvatar"
' below I tried to add appropriate TYPE
column.DataType =
System.Type.GetType("System.Web.UI.WebControls.ImageField")
'System.Type.GetType("System.String")

dt.Columns.Add(column)

' URLs are different for each user
For i = 0 To (dt.Rows.Count - 1)
dt.Rows(i)("UserName") = dipUser.Username
dt.Rows(i)("UserAvatar") = dipUser.AvatarAbsoluteUrl
Next i

dlComments.DataSource = dt '
objCtl.GetByNukeNews_News(ControlForeignKey)
dlComments.DataKeyField = "ID"
dlComments.DataBind()

<asp:datalist id="dlComments" Runat="server">
<ItemTemplate>
<table>
<tr>
<td>
<TR>
<TD class="RatingLabelRow"><
%#DataBinder.Eval(Container.DataItem, "UserAvatar") %>

</td>
<td
class="RatingLabelRow">Rating:</td>
<td class="RatingRow"><
%#DataBinder.Eval(Container.DataItem, "Rating")%></td>
</tr>
<tr>
<TD class="RatingLabelRow" ><
%#DataBinder.Eval(Container.DataItem, "UserName")%>

</TD>
</tr>
</td>
</tr>

<tr>
<td colspan="2" class="CommentsRow"><
%#DataBinder.Eval(Container.DataItem, "Comments")%></td>
</tr>
</table>
</ItemTemplate>
</asp:datalist>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top