Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 16th, 2007, 04:58 PM
Authorized User
 
Join Date: Oct 2006
Posts: 42
Thanks: 3
Thanked 0 Times in 0 Posts
Default How to do an image pop-up from a dynamic page

Hello,

I'm new to ASP.NET, and I've been puzzling over how to accomplish a certain task.

   1. Almost any large catalog website - say, LLBean or Lands End -- has a template product page that pulls up product picture, text, and prices from a database. Most of these sites allow you to see a large pop-up photograph of, say, a hiking **************** when you click on the small image on the product page.

   2. A small image on a webpage that pops-up into a larger-sized window when clicked is pretty common, and not difficult to do with an image that is static, or "hard coded" into a page.

   3. What I don't understand is how to do a click-and-pop-up window not from a hard-coded image, but from one that has been pulled down - "dynamically" - from a database onto an .aspx page. I have several ASP.NET books, and not one explains how to do this.

So, for example, a "productdetail.aspx" page will have have empty containers in which to pour data about the specific product being brought up from the database: product description, the price "$17.99", and a URL to the product photograph. The picture container on teh page I am working on looks like this:

<asp:Image ID="Image3" ImageUrl='<%#DataBinder.Eval(Container.DataItem, "small_image")%>' AlternateText='View Details' Runat="server" width="100">
</asp:Image>

Since there is no product image attached to the actual "productdetail.aspx" webpage, how would a pop-up window 'know' which image it is pulling up for its detail view when it is clicked?

Any advice and help appreciated!
 
Old March 24th, 2007, 06:24 PM
Authorized User
 
Join Date: Apr 2005
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I haven't done this before either but I can help point you in the right direction as I think I see the answer in my head. :)

For any popup it will have to be triggered via javascript. With that you have 2 choices you can go. You can do this by hand which I can explain how you can do it on the page itself but with the code behind you will add a click even to the image item and in that event you would use the clientscript class to send java back to the page. The javascript will use the window.open() function to pass in the url to the other page and parameters via the url to identify the image in the database. On the other page you will have in the code behind page_load event code to grab the parameters from the url that were passed to it and query your database you get the info you need related to the image. window.open() in javascript will open a new window.

Another way is use MS AJAX with the same method. The difference is you will not get the flashing postback before the popup being displayed with AJAX. :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display image in a pop-up window nrlahoti ASP.NET 2.0 Professional 1 October 15th, 2007 07:28 AM
Newbie Question RE Image pop ups Nostromo77 ASP.NET 2.0 Basics 0 December 10th, 2006 07:31 PM
Help - Dynamic Pop-down lists phpcoder1 PHP How-To 0 November 8th, 2004 12:02 PM
Pop up menu for image joshil Dreamweaver (all versions) 0 May 14th, 2004 12:58 PM
closing a pop up which also goes to a new page twowoo HTML Code Clinic 2 October 21st, 2003 04:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.