dynamic image? store and retrieve properties values? resizable web control?

B

bob95226

I'm designing a web control, there are 3 issues for me:

(1) How to display a dynamic image in the web control, can HttpModules
and ControlDesigner do it?

(2) How to store and retrieve the properties values? so runtime web
control can set properties values based on designer time settings?

(3) How to make web control resizable during the designer time?

Thanks,

Bob
 
A

Alessandro Zifiglio

hi Bob,

1. You can add the images to your project, right click on them and go in the
properties window and change the build action to "Embedded resources". To
retrieve the resources you can use the ClientScriptManager.GetWebResourceUrl
Method. Also dont forget to apply the WebResourceAttribute metadata
attribute to mark the assembly for the resources that will be served. The
sample code in the following msdn resource covers all this, and since you
have images and they were gif format, you would do for eg.
[assembly: WebResourceAttribute("mydllname.imagename.gif", "image/gif")]
instead of
[assembly: WebResource("script_include.js", "application/x-javascript")]
as per the sample code.

http://msdn2.microsoft.com/en-us/li...scriptmanager.getwebresourceurl(d=robot).aspx

2. You just expose public properties with getters and setters. Optionally
storing also into viewstate for persistance between postbacks for properties
set in code versus set declaratively on the vs.net designer. You can
reference the following resources on msdn :
http://msdn2.microsoft.com/en-us/library/ms178648.aspx

3. You associate your custom web control with a ControlDesigner. This
reference on msdn included below might help you get started, however it only
scratches the surface so you might want to look for other references as you
deal with issues or want to do more than what you see in the sample code :
http://msdn2.microsoft.com/en-us/library/system.web.ui.design.controldesigner.aspx

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net
 
B

bob95226

Alessandro,

Thanks for your posting!

I want to display a dynamic image (e.g. chart image) which is created
by web control on the fly (not from a physical file)

I managed to make the dynamic image work during the runtime via
HttpModules, however I don't know how to make the image visible during
the design time.

Not much documentation available on how to make web control resizable
during the design time ...

Thanks,

Bob


Alessandro said:
hi Bob,

1. You can add the images to your project, right click on them and go in the
properties window and change the build action to "Embedded resources". To
retrieve the resources you can use the ClientScriptManager.GetWebResourceUrl
Method. Also dont forget to apply the WebResourceAttribute metadata
attribute to mark the assembly for the resources that will be served. The
sample code in the following msdn resource covers all this, and since you
have images and they were gif format, you would do for eg.
[assembly: WebResourceAttribute("mydllname.imagename.gif", "image/gif")]
instead of
[assembly: WebResource("script_include.js", "application/x-javascript")]
as per the sample code.

http://msdn2.microsoft.com/en-us/li...scriptmanager.getwebresourceurl(d=robot).aspx

2. You just expose public properties with getters and setters. Optionally
storing also into viewstate for persistance between postbacks for properties
set in code versus set declaratively on the vs.net designer. You can
reference the following resources on msdn :
http://msdn2.microsoft.com/en-us/library/ms178648.aspx

3. You associate your custom web control with a ControlDesigner. This
reference on msdn included below might help you get started, however it only
scratches the surface so you might want to look for other references as you
deal with issues or want to do more than what you see in the sample code :
http://msdn2.microsoft.com/en-us/library/system.web.ui.design.controldesigner.aspx

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net

I'm designing a web control, there are 3 issues for me:

(1) How to display a dynamic image in the web control, can HttpModules
and ControlDesigner do it?

(2) How to store and retrieve the properties values? so runtime web
control can set properties values based on designer time settings?

(3) How to make web control resizable during the designer time?

Thanks,

Bob
 
A

Alessandro Zifiglio

Bob, unfortunately, if this is for a dynamic image you are generating then i
dont find anything useful on msdn and i'll conclude that it is not a
supported feature in visual studio 2005. I just know that by looking at the
url generated in debug mode, for image resources, the images are prefix with
a special protocol mvwres: and handled through the IResourceUrlGenerator,
you can lookup it up here :
http://www.nikhilk.net/WebResourceAttributeAtDesignTime.aspx
http://msdn2.microsoft.com/en-us/library/system.web.ui.iresourceurlgenerator.aspx

However that implies that you have an embedded resource. It does not seem
like it takes a stream file which is what you want.

The only alternative is to look at antonio bakula's PStreamImage, which
seems to be free and supposedly working at designtime too. You can look it
up at the following url :
http://www.antoniob.com/projects/PStreamImage.aspx

For resizing the control, associate a controldesigner and return true for
allowResize property as per that example on msdn i posted earlier.

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net

Alessandro,

Thanks for your posting!

I want to display a dynamic image (e.g. chart image) which is created
by web control on the fly (not from a physical file)

I managed to make the dynamic image work during the runtime via
HttpModules, however I don't know how to make the image visible during
the design time.

Not much documentation available on how to make web control resizable
during the design time ...

Thanks,

Bob


Alessandro said:
hi Bob,

1. You can add the images to your project, right click on them and go in
the
properties window and change the build action to "Embedded resources". To
retrieve the resources you can use the
ClientScriptManager.GetWebResourceUrl
Method. Also dont forget to apply the WebResourceAttribute metadata
attribute to mark the assembly for the resources that will be served.
The
sample code in the following msdn resource covers all this, and since you
have images and they were gif format, you would do for eg.
[assembly: WebResourceAttribute("mydllname.imagename.gif", "image/gif")]
instead of
[assembly: WebResource("script_include.js", "application/x-javascript")]
as per the sample code.

http://msdn2.microsoft.com/en-us/li...scriptmanager.getwebresourceurl(d=robot).aspx

2. You just expose public properties with getters and setters. Optionally
storing also into viewstate for persistance between postbacks for
properties
set in code versus set declaratively on the vs.net designer. You can
reference the following resources on msdn :
http://msdn2.microsoft.com/en-us/library/ms178648.aspx

3. You associate your custom web control with a ControlDesigner. This
reference on msdn included below might help you get started, however it
only
scratches the surface so you might want to look for other references as
you
deal with issues or want to do more than what you see in the sample code
:
http://msdn2.microsoft.com/en-us/library/system.web.ui.design.controldesigner.aspx

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net

I'm designing a web control, there are 3 issues for me:

(1) How to display a dynamic image in the web control, can HttpModules
and ControlDesigner do it?

(2) How to store and retrieve the properties values? so runtime web
control can set properties values based on designer time settings?

(3) How to make web control resizable during the designer time?

Thanks,

Bob
 

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

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top