i have a data list for an image gallery (four columns, however many
rows).
on ItemDataBound, i am checking to make sure that the user has added
images to the gallery, if not i would like to not render that column
or item.
as i have it now, i am simply making the item not visible, but that
is still rendering the table for the data list, leaving a space in
the page that is blank.
i cannot seem to find a reasonable example for how to not draw an
item using the RenderItem method or any other possible method, if
there is one.
below is the code i am using ... any pointers would be very cool.
Private Sub dlGallery_ItemDataBound(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.DataListItemEventArgs) Handles
dlGallery.ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim oConn As OracleConnection = CreateOraConn(Application
("ConnectionString"))
Dim sSQL As String
Dim sImagePath As String
Dim dtrImageName As OracleDataReader
Dim imgImage As HtmlImage
Dim dtCheckImages As DataTable
Dim hplTmp As HyperLink
imgImage = e.Item.FindControl("imgGalleryImage")
hplTmp = e.Item.FindContro("hplGallerySpecific")
sSQL = "SELECT ImageName FROM vw_GalleryImages WHERE GalleryID=" &
DataBinder.Eval(e.Item.DataItem, "GalleryID") & " AND ROWNUM=1"
dtCheckImages = LoadDataTable(sSQL, "vw_GalleryImages", Application
("ConnectionString"))
If dtCheckImages.Rows.Count > 0 Then
dtrImageName = LoadReader(sSQL, oConn)
While dtrImageName.Read()
sImagePath = dtrImageName("ImageName")
End While
If sImagePath.Length > 0 Then
sImagePath = Server.MapPath
("images/ImageManager/general/" & sImagePath)
Dim aHeightWidth() As Double = SetImageManagerSize
(sImagePath, 75, 75) 'filepath, height,
width
imgImage.Height = aHeightWidth(0)
imgImage.Width = aHeightWidth(1)
imgImage.Visible = True
imgImage.Src = sImagePath
hplTmp.NavigateUrl = "galleryspecific.aspx?
GalleryID=" & DataBinder.Eval(e.Item.DataItem, "GalleryID")
hplTmp.Text = DataBinder.Eval
(e.Item.DataItem, "EventTitle")
Else
e.Item.Visible = False
imgImage.Visible = False
End If
Else
''''''''''''''''''''''''''''''''''''
'' This is the questionable part
'' Not sure what to send to RenderItem
'''''''''''''''''''''''''''''''''''''''''
Dim Renderer As Html32TextWriter
e.Item.RenderItem(Renderer, False, False)
'e.Item.Visible = False
'imgImage.Visible = False
End If
End If
End Sub
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/