http://www.epocasf.com/showroom/fete.aspxThis is an asp page that uses a DataList to generate the thumbnails and clickthrough.
I want to add events and have them contained in this same shell. Using an events / categories table to drive the selection of an image gallery. New galleries could be chosen as a default with the selected index.
Sample code to bind the list is as follows:
Sub Page_Load(sender As Object, e As EventArgs)
Dim mySortedList As SortedList
Dim intSelectedPhotoIndex As Integer
Dim strPhotoId As String
Dim strPhotoTitle As String
mySortedList = New SortedList()
mySortedList.Add("001", "Fete - working the other corner<br />June 28th 2007 celebration of epoca's new corner. Photo: Dave Morffy.")
mySortedList.Add("002", "Fete - working the other corner<br />June 28th 2007 celebration of epoca's new corner. Photo: Dave Morffy.")
mySortedList.Add("003", "Fete - working the other corner<br />June 28th 2007 celebration of epoca's new corner. Photo: Dave Morffy.")
mySortedList.Add("004", "Fete - working the other corner<br />June 28th 2007 celebration of epoca's new corner. Photo: Dave Morffy.")
...ecetera.. ecetera....
How do I convert this into that format?
I had some success with
http://www.epocasf.com/showroom/fete2.aspxI created a table of events/categories I call: tblpromotype
that ties into a table of each photo called tblSR
I bind the dataList like this:
Sub BindDataList()
Dim conGCA As OleDbConnection
Dim cmdSelect As OleDbCommand
Dim dtrCategories As OleDbDataReader
conGCA = New OleDbConnection("Provider=
Microsoft.
Jet.OLEDB.
4.0;data source=D:\WWWROOT\epocasfc
om\Databas
e\epocav3.
mdb")
cmdSelect = New OleDbCommand("Select tblSRid, tblSRPromotype, tblSRImg,tblSRcaption,tblS
Rphotograp
her,tblSRi
mgwidth, tblSRimgheight, tblSRDatecreated, tblSRthumbwidth, tblSRthumbnailheight, tblSRinclude From tblSR Order By tblSRDatecreated Desc", conGCA)
conGCA.Open()
dtrCategories = cmdSelect.ExecuteReader()
PhotoDataList.DataSource = dtrCategories
PhotoDataList.DataBind()
dtrCategories.Close()
conGCA.Close()
End Sub
the datalist renders..
but. I 'm stuck on the click through aspect of it; the selected item...
how would I do that.?
I like the format here..its fine.. I just would like it to be more flexible..
any ideas?
the rest of the code is here:
I didn't elimiate the manual bind but its not being utilized.. but it is garbage on my page which, yes, i need to clean up.
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
BindDataList()
Else
End If
Dim mySortedList As SortedList
Dim intSelectedPhotoIndex As Integer
Dim strPhotoId As String
Dim strPhotoTitle As String
mySortedList = New SortedList()
mySortedList.Add("1", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("2", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("3", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("4", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("5", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("6", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("7", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("8", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("9", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("10", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("11", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("12", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("13", "Los Angeles Antiques Show <br /> epoca booth 10")
mySortedList.Add("14", "Los Angeles Antiques Show <br /> epoca booth 10")
strPhotoId = Request.QueryString("photo
")
If strPhotoId = "" Then
PhotoDetailPanel.Visible = False
' PhotoDataList.DataSource = mySortedList
' PhotoDataList.DataBind()
Else
'intSelectedPhotoIndex = mySortedList.IndexOfKey(st
rPhotoId)
strPhotoTitle = mySortedList.GetByIndex(in
tSelectedP
hotoIndex)
litPhotoTitle.Text = strPhotoTitle
imgPhoto.ImageUrl = "fete/images/" '& DataItem("tblSRImg") & " .jpg"
imgPhoto.AlternateText = strPhotoTitle
If intSelectedPhotoIndex = 0 Then
linkPrev.Visible = False
Else
linkPrev.Visible = True
linkPrev.NavigateUrl = "fete2.aspx?photo=" '& tblSRImg
End If
If intSelectedPhotoIndex = mySortedList.Count - 1 Then
linkNext.Visible = False
Else
linkNext.Visible = True
linkNext.NavigateUrl = "fete2.aspx?photo=" _
& mySortedList.GetKey(intSel
ectedPhoto
Index + 1)
End If
PhotoDetailPanel.Visible = True
End If
End Sub
</script>
in the body tags :
<form>
<asp:DataList id="PhotoDataList" runat="server"
BorderWidth = 10
GridLines = "None"
RepeatColumns = 6
RepeatDirection = "Horizontal"
BorderStyle="Solid" BackColor="#ffffff" Width="480" HorizontalAlign="Left" CssClass="gallery100" AlternatingItemStyle-Borde
rStyle="No
tSet" BorderColor="#f9f9ef">
<ItemTemplate>
<a href="fete2.aspx?photo=<%#
Container.DataItem( "tblSRImg" ) %>"><img src="fete/thumbnails/<%# Container.DataItem( "tblSRImg" ) %>.jpg" border="0" /></a>
</ItemTemplate>
<FooterTemplate>
<table style="width:auto;margin-l
eft:30px">
<tr ><td style="width:183px;text-al
ign:center
;"><a class="siteindex" href="
http://www.epocasf.com/" target="_top">search</a></
td><td style="width:183px;text-al
ign:center
;"><a class="siteindex" href="
http://www.epocasf.com/showroom/photos.aspx" target="_top">showroom</a>
</td><td style="width:183px;text-al
ign:center
;"><a class="siteindex" href="
http://www.epocasf.com/" target="_top">contact</a><
/td></tr><
/table>
</FooterTemplate>
</asp:DataList>
<asp:Panel id="PhotoDetailPanel" runat="server" HorizontalAlign="left" Width="480" BackColor="#8CD5EC">
<span style="background-color:#f
fffff;padd
ing: 10px 10px 25px 10px;border:solid thin white;float:left;margin-le
ft:10px;">
<span class="title" style="margin-left:15px;ma
rgin-right
:20px;marg
in-bottom:
20px;">
<asp:HyperLink id="linkPrev" runat="server" Text = "previous" CssClass="gallerylg" />
</span>
<span class="title" style="margin-left:20px;ma
rgin-right
:10px;marg
in-bottom:
20px;">
<asp:HyperLink id="linkNext" runat="server" Text = "next" CssClass="gallerylg" />
</span>
<br /><br />
<asp:Image id="imgPhoto" runat="server" CssClass="width:auto;heigh
t:auto;bac
kground-co
lor:#fffff
f;padding:
10px 10px 25px 10px;border:solid thin ;" />
<br />
<span class="title"><asp:Literal
id="litPhotoTitle" runat="server" /></span>
<br /><br />
<span class="title" style="margin-top:16px;">
<a class="gallerylg" href="fete2.aspx">back to all los angeles photos</a>
</span >
</span>
</asp:Panel>
</form
Is this all too nonsensical ?
thanks for looking at all of this..