olidev
olidev

Reputation: 20644

set a div image on another div image asp.net

Would it be possible to set a div image over another div image in asp.net?

For example: after having an image A, the user chooses an image B with location 10, 10 then the image B will be placed at location 10, 10 on the image A (not merging).

Or it is required to use jQuery?

Thanks in advance.

Upvotes: 0

Views: 196

Answers (1)

Robin Andersson
Robin Andersson

Reputation: 5380

I assume that you are running Web Forms.

You can accomplish this by wrapping the images in a position relative div and then position them absolute, you can do this from the code behind.

Here is the HTML + CSS to demonstrate this: http://jsfiddle.net/GuafM/

The serverside code to add the dot would look something like this:

Image imgDot = new Image();
imgDot.ImageUrl = "http://upload.wikimedia.org/wikipedia/commons/6/6e/Paris_plan_pointer_b_jms.gif";
imgDot.Style["top"] = "10px";
imgDot.Style["left"] = "10px";

divImageWrapper.Controls.Add(imgDot);

If you want the user to drag and drop (or similar complex client side behaviour) a image on top of another I would probably recommend that you use jQuery.

Upvotes: 1

Related Questions