TRU
Posts: 15
Joined: Fri Jan 16, 2009 1:20 am

Asp.Net in VB from Database

Can you direct me to code examples or working examples where highslide has been used in asp.net VB where the image file come from a database rather than hardcoded?

It would be great to be able to upload images via a web form and have the images auto populate a page rather than editing the html for additions and deletions of images.

Thanks,

TRU
torstein.honsi
Site Admin
Posts: 9215
Joined: Thu Nov 09, 2006 11:22 am
Location: Vik i Sogn, Norway

Hi TRU,

If you can make VB create img tags and anchor tags, you can apply Highslide to them. Highslide only needs onclick="return hs.expand(this)" or rel="highslide" to work.
TRU
Posts: 15
Joined: Fri Jan 16, 2009 1:20 am

Thanks for the reply. Will see what I can do.

TRU
TRU
Posts: 15
Joined: Fri Jan 16, 2009 1:20 am

Solution

:D Well I was able to get the barebones default functionality working on this so I thought I would share.

I used a hyperlink control inside a datalist.

In the db are 5 fields. ID,iLarge,iThumb,iCaption,iName

Properties for the hyperlink control are below.

<asp:HyperLink ID="HyperLink1" onclick="return hs.expand(this)" runat="server"
ImageUrl='<%# Eval("iThumb", "images/gallery/11inch/{0}") %>'

NavigateUrl='<%# Eval("iLarge", "images/gallery/11inch/{0}") %>'

Text='<%# Eval("iName", "{0}") %>'></asp:HyperLink>

<asp:Label ID="iNameLabel" class="highslide-caption" runat="server" Text='<%# Eval("iCaption") %>' />


Would be interested if anybody else wants to share any modifications.

I hope this helps somebody else.

TRU
fitzy
Posts: 2
Joined: Wed Feb 04, 2009 5:36 am

Re: Asp.Net in VB from Database

Hi Tru

I was refered to this site by a collegue.

I'm new to web development, but this tool looks good and I think will be useful.

Could you please elaborate further in how images could be retrieved from a database.

That is, could you provide a simple example of a query to obtain the image records from the database and have them linked to the HighSlide object on a web page.

Sorry if this is a basic question, but I'm new to web development and any help appreciated.

TIA
TRU
Posts: 15
Joined: Fri Jan 16, 2009 1:20 am

Re: Asp.Net in VB from Database

Not sure how much help I can be other than sharing my code.

This is based on the asp.net framework.

AccessDataSource

Code: Select all

	<asp:AccessDataSource ID="galleryDS" runat="server" 
                    DataFile="~/App_Data/yourdb.mdb" 
                    SelectCommand="SELECT [kThumb], [kLarge], [kShortDesc], [kLongDesc] FROM [imagegallery]">
                </asp:AccessDataSource>


Datalist Control with Hyperlink Control and Label Control

Code: Select all

                            <asp:DataList ID="sidegalleryDL" runat="server" DataSourceID="galleryDS" 
                                RepeatColumns="5" RepeatDirection="Horizontal">
                                <ItemTemplate>

                                    <asp:HyperLink ID="HyperLink2" runat="server" 
                                        ImageUrl='<%# Eval("kThumb", "images/gallery/{0}") %> ' 
                                        NavigateUrl='<%# Eval("kLarge", "images/gallery/{0}") %>' 
                                        onclick="return hs.expand(this)" Text='<%# Eval("kShortDesc", "{0}") %>'></asp:HyperLink>
                                    <asp:Label ID="iNameLabel" runat="server" class="highslide-caption" 
                                        Text='<%# Eval("kLongDesc") %>' />
                                </ItemTemplate>
                            </asp:DataList>
Build your database based on the above info, make your connections, and it should work.

Of course you will need your highslide code on the site as well and referenced in your page.

Good Luck,

TRU
fitzy
Posts: 2
Joined: Wed Feb 04, 2009 5:36 am

Re: Asp.Net in VB from Database

Thanks TRU.

Will give it a go later on today.

Regards
Fitzy

Return to “Highslide JS Usage”