The term pop-up is ambiguous with the widespread use of "lightbox" features.
Pop-up windows created via window.open() are no different from other web pages (other than their size etc.) Meaning that the url for this type of pop-up window can have an aspx extension and asp.net codebehind. So the normal stuff applies. One solution would be to create a URL with a querystring name/value pair that indicates which image to pull from the database. In the aspx codebehind for the pop-up, you can capture the querystring value and use it to get the image from your database.
hope this helps.
Sincerely,
Carl
-----
vine type - content management with standards in mind -
vinetype.com-----