|
-
Jan 28th, 2004, 09:42 AM
#1
Thread Starter
Frenzied Member
Display image in Datagrid
I am trying to display an image in a datagrid. I have a field in the database that is true or false. What I want to do is if the field is true, then display the true image in the datagrid, otherwise display the false image.
VB Code:
Dim dtUsers As JHALibrary.ADORoutines.CDataTableAdvanced
Dim drUsers As DataRow
dtUsers = objConn.GetUsersForProduct(ProductID)
For Each drUsers in dgUsers.Rows
If(dgUsers("FieldName") <> 0) Then
'Display the true image
Else
'Display the false image
End If
Next
dgUsers.DataSource = dtUsers
dgUsers.DataKeyField = "EnhancementSubmitterID"
dgUsers.DataBind()
I am lost as to what code I should place there, since nothing seems to work.
Last edited by Memnoch1207; Jan 28th, 2004 at 10:57 AM.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Jan 28th, 2004, 12:42 PM
#2
Thread Starter
Frenzied Member
Nevermind, I figured a way to do it...
Code:
<asp:TemplateColumn HeaderText="Submitter">
<HeaderStyle CssClass="HEADERSTYLE"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<img src='images\<%# Databinder.Eval(Container.DataItem,"QualifiedSubmitter")%>.gif'>
</ItemTemplate>
</asp:TemplateColumn>
and the images are named (0.gif and -1.gif)
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|