[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 385
  • Last Modified:

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

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
  • 4
  • 3
1 Solution
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?
acancelAuthor Commented:
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")
        rsq.open(strsql, 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.
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?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

acancelAuthor Commented:
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?
acancelAuthor Commented:
figured out the multiple variables....... CID=0&PID=001....slowly but surely
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.
acancelAuthor Commented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now