Need to pass Real Estate ID from page1.aspx to page2.aspx to retrieve multiple images of that Property

Posted on 2006-05-16
Last Modified: 2006-11-18
Hello All

I am new to aspx, using Visual Studio, and I am trying to accomplish the following scenario.

I have a Real Estate website that I am trying to display featured properties on the home page, then upon clicking on the property, the property details with additional images will come up in a second aspx page.

What I have so far:
Property 1:
img src = image2.aspx?ID=0 (this is calling the image for the first featured property image from an Access database)

What I need:
Upon clicking of the Property 1 image, I need a second aspx page to open up with 6 additional images of Property 1

Thanks for your help
Question by:acancel
    LVL 7

    Expert Comment

    I assume you know how to retrieve data from the database? If so, you would want to pass the propertyid to your second page. On the page load event, you would want to retrieve the images from the database and simply output them to the page. If your image numbers will vary based on the property, you would be interested in using a DataGrid or a DataRepeater control. Are you storing the image file itself as binary data in the database or just a path to the file?

    Author Comment

    Yes, i do know how to query the database but I dont know how to pass and retrieve the id on the second page. let me get a little more detailed in my examples.

    This is the code for the actual image 1, which is located in listing control 0 (there are 5 listing controls, 0-4):
    <img border="1" src="image2.aspx?ID=0" width="75" height="60">

    This is the code for image2.aspx:
    <%@ Page Explicit="True" Language="VB" Debug="True" %>

    <script runat="server">

        Dim strADO, strsql
        Sub GetIDs()  
            Dim rsq = Server.CreateObject("ADODB.Recordset")
            Dim objCon As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=" & Server.MapPath("App_Data/CI.mdb")
            strsql = "select * FROM ASPX_Image WHERE Listing =" & Request.QueryString("ID")
  , objCon)

        End Sub



    This works fine, i think, as I am able to get the image from the path within the database for whatever image has 0 in the listing field. That way, all I have to change is the listing number and the images will reflect that change

    Where I am stuck is that I would assume that I need to do the following:
    1. auto-generate the link url to the propertydetails.aspx page with the property id # (lets say 001) [can do this in Access]
    2. retrieve that link and re-populate the "more details" link under that property on the home page (lets say propertydetails.aspx?PID=001)
    3. upon clicking of the link, have the propertydetails.aspx query the database for the additional pictures (lets say image2.aspx?PID=001;CTLID=0) where CTLID could be the ctl number for the respective image holders

    Am not sure if I am making any sense.
    LVL 7

    Expert Comment

    Haha. Well you seem to be on the right track at least. Let me see if I can tell you what you want to do and you tell me if it's correct.

    You have a main picture for Property 0 on the homepage. The client clicks the picture and they are redirected to a more detailed page on that property that lists several other pictures in the database. Is this correct?

    Now about your image page: I would recommend using the new ADO.NET classes for retrieving your info. Look into System.Data.OleDB for more information on that. I have actually never attempted to store a file in a database, let alone an ACCESS database. All the research I've done as suggested not to do that. Furthermore, you're going to need some sort of image id that tells you which image is the main image and which ones are the detail page images. That thing with the images storing is just a recommendation.

    Am I correct about this thus far?

    Author Comment

    you are correct. I do have an image table with their own respective ids. However, in writing these comments out, i think what I need is the following:

    1.change the image.aspx to query two variable from a url. The CID (control id) and PID (property id)
    2.change the initial call on the home page to the image page from image.aspx?ID=0 to something like image.aspx?CID=0;PID=001.
    3.have the more details link read propertydetails.aspx?PID=001
    4.upon opening of the more details page, the image controls with img srcs of image.aspx?CID=0;PID=001 and so forth will then pull the respective image urls.

    The question would then be, how do i populate the img src on the property details page with the correct PID? I assume I would use the request query to obtain the id from the url. But A) can we have to variables in the url (have seen this) and B) where and how do i call the request query?

    Author Comment

    figured out the multiple variables....... CID=0&PID=001....slowly but surely
    LVL 7

    Accepted Solution

    You can send them like that "CID=0&PID=001" and then you merely reference them like so:


    You should be able to use your image aspx page to get the image for each one. Just modify the code to use the CID variable. On the main photo on the homepage you can send the CID of 0 or -1. Make all your main photo CIDs 0 or -1 and voila.

    I've got to get some stuff at work before I leave today and I won't be in tomorrow. But I can look at this in more detail on Thursday most likely. Sorry to have to be so short.

    Author Comment

    ok, thanks. I have actually gotten that part to work as well. I am now trying to resolve placing the ID number with the image url on the details page...see question Reference a variable in class code behind ASPX with the vb source code for more details. Thanks for all your help

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now