Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

DetailsView issue with Lightbox...

  • 20-02-2011 11:03am
    #1
    Closed Accounts Posts: 3,912 ✭✭✭


    Hi Folks,

    I've a DetailsView that displays some data on a page on my site, stored in my MS SQL 2005 DB. I've images also stored in my DB and they are displaying fine on my site via Lightbox and an <A HREF> link, and the lightbox works fine with displaying the images when the data is displayed in a container...

    So from that I'm assuming that my images are uploading and displaying fine, via my lightbox, when I'm not trying to display an <A HREF> link to the images via my DetailsView...

    So... I've made a template field out of the DetailsView, and the code below works, insofar as it properly references the viewimage:

    <ItemTemplate>
    <link rel="stylesheet" href="~/css/lightbox.css" type="text/css" media="screen" />
    <a href='viewimage.aspx?img=<%# Eval("Id") %>' rel="lightbox" style="color: #FF3300; font-family: Verdana; font-size:inherit; font-weight: normal;">Image</a>
    </ItemTemplate>


    And I've not forgotten to include the following code in the <head> of the of the page:

    <script type="text/javascript" src="js/prototype.js"></script>
    <script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
    <script type="text/javascript" src="js/lightbox.js"></script>

    What I've got here so far is displaying the image, only it's not displaying it in the lightbox as I want it to, the image is being displayed in a new page (imageview.aspx)... I'm getting back the proper string for the page (viewimage.aspx?img=1), all seems to be working properly in relation to the correct referencing of the image, but the Lightbox will still not work...

    I am using a MasterPage but I've created a new "stand alone" .aspx page to eliminate the possibility of this being a problem with the fact that I'm using a MasterPage, so all have now is an aspx page with an SQL datasource connection, a DetailsView, with a template field edited as above, which does display my image, just not via the Lightbox pop up with the page shaded out which is the result I'm looking for.

    I'm just wondering is there possibly some reason that I'm not aware of, related to the properies of the DetailsView, that will not allow me to use a Lightbox, no matter what way I go about it???

    Thanks in advance for any help with this...


Comments

  • Closed Accounts Posts: 3,912 ✭✭✭HellFireClub


    I'm obviously doing something very fundamentally wrong with my Lightbox because when I set up the <A HREF> outside of the DetailsView and hardcode it to point directly at my DB using <a href='viewimage.aspx?img=1' rel="lightbox" style="color: #FF3300; font-family: Verdana; font-size:inherit; font-weight: normal;">
    , it still open the image but again, in a new page, not using my Lightbox as I want, even though my Lightbox is working on all other pages?!? :confused::confused::confused:


  • Closed Accounts Posts: 3,912 ✭✭✭HellFireClub


    Hallalujha, for anyone else who runs into this issue, the problem is easily resolved, the viewimage.aspx file has to be in the same directory as the .aspx file that is calling it, also, all the Lightbox external files such as the .js files and the .css file folders, and their file contents (4 files altogether), have to also be sitting in the same directory that your mainpage.aspx file is in, even though VWD 2010 intellisense will tell you that the link is correct if you are pointing back to the same files in another directory that you might be using, I'm not too sure why I can't just reference a file properly if it is another folder that I choose to put it in but obviously some of the files above reference each other or the original file that is calling it and gets confused if they are not all working within the same directory...

    Anyway, issue resolved, happy Sunday!


  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    glad you are sorted but
    the problem is easily resolved, the viewimage.aspx file has to be in the same directory as the .aspx file that is calling it
    that might be because your code does not have a full path to the viewimage.aspx. You have
    [PHP]<a href='viewimage.aspx?img=<%# Eval("Id") %>' rel="lightbox" style="color: #FF3300; font-family: Verdana; font-size:inherit; font-weight: normal;">Image</a> [/PHP]
    but it should be
    [PHP]<a href='myotherfodler/viewimage.aspx?img=<%# Eval("Id") %>' rel="lightbox" style="color: #FF3300; font-family: Verdana; font-size:inherit; font-weight: normal;">Image</a> [/PHP]


    I would also consider removing the images from the database and storing on disk and just store the relative paths in the db. Much easier


Advertisement