Image in Designer (VS 2005)

S

Shawn B.

Greetings,

I'm creating a custom server control. In the design-time experience, I'd
like to render an image where the control is placed. I have an /images
folder in my website.

The problem is, when I render the <img src=... tag during the design-time
experience, nothing displays. When I run the web, it works fine. I've even
try hardcoding the URL (based on an IIS path), and that doesn't work either.

My question is simple: how do I reference a root relative URL during
designtime in a custom server control? Page.MapPath throws a null reference
exception. Perhaps theres something else I can use?


Thanks,
Shawn
 
A

Antonio Bakula

My question is simple: how do I reference a root relative URL during
designtime in a custom server control? Page.MapPath throws a null reference
exception. Perhaps theres something else I can use?

I had an check if is designtime (is Site assigned) and if assigned then I
copied image in temp directory and set this new filename to ImageUrl (my
component inherits from WebControls.Image)

But my control used images from stream, I really don't know how will you
know *where* your pictures are.

btw. if it helps here is the link to my stream image component, source
included.

http://www.antoniob.com/projects/PStreamImage.aspx

beware: Delphi.NET and framework 1.x !!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top