It is currently Wed Apr 23, 2014 9:10 am Advanced search

Asp.Net in VB from Database

Technical support, bug reports, feature requests and more.

Asp.Net in VB from Database

Postby TRU » Fri Jan 16, 2009 3:25 am

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
TRU
 
Posts: 15
Joined: Fri Jan 16, 2009 3:20 am

Postby torstein.honsi » Fri Jan 16, 2009 11:53 am

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.
User avatar
torstein.honsi
Site Admin
 
Posts: 9181
Joined: Thu Nov 09, 2006 1:22 pm
Location: Vik i Sogn, Norway

Postby TRU » Fri Jan 16, 2009 4:23 pm

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

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

Solution

Postby TRU » Sat Jan 17, 2009 7:12 am

: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
TRU
 
Posts: 15
Joined: Fri Jan 16, 2009 3:20 am

Re: Asp.Net in VB from Database

Postby fitzy » Wed Feb 04, 2009 7:44 am

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
fitzy
 
Posts: 2
Joined: Wed Feb 04, 2009 7:36 am

Re: Asp.Net in VB from Database

Postby TRU » Thu Feb 05, 2009 2:52 am

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
TRU
 
Posts: 15
Joined: Fri Jan 16, 2009 3:20 am

Re: Asp.Net in VB from Database

Postby fitzy » Thu Feb 05, 2009 4:45 am

Thanks TRU.

Will give it a go later on today.

Regards
Fitzy
fitzy
 
Posts: 2
Joined: Wed Feb 04, 2009 7:36 am


Return to Highslide JS Usage

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests