Click here to Skip to main content
14,022,935 members
Click here to Skip to main content
Add your own
alternative version

Stats

26.9K views
133 downloads
13 bookmarked
Posted 15 Jul 2007
Licenced CPOL

ASP.NET 2.0 VS Custom Renderer - Data Bindable Image Control

, 15 Jul 2007
Rate this:
Please Sign up or sign in to vote.
This project contains a Web Custom Control for rendering images directly from the database. Can be used with image fields, with text, date, or number fields (it generates an image containing the text), and with URL fields (like a regular image control).

Introduction

This project contains a Web Custom Control for rendering images directly from the database. It can be used with image fields, with text, date, or number fields (it generates an image containing the text), and with URL fields (like a regular image control).

Check v.2.0 here.

Background

This project was inspired by an article on CodeProject written by dev2dev: Create Dynamic Images in ASP.NET. Parts of the code were taken from that project.

How it Works

Basically, this control takes the value from the database field (image, text, date/time, numeric values), generates a temporary image, and forwards the generated file to a classic image control.

Points of Interest

To test this control:

  • Open or create a website.
  • Add the VSCustomRendererLibrary reference to the website.
  • Open/create a new ASPX page.
  • Add a SqlDataSource connected to a table or a view (this project was tested with SQL Server 2005 EE).
  • Add a GridView and connect it to the SqlDataSource.
  • In the GridView, add the image column and transform it into a template field.
  • Select Edit Template from the GridView toolbar menu.
  • Add a VSCustomRenderer into the ItemTemplate. Bind the control to the data source field.

Screenshot - databind.gif

You can bind:

  • ImageValue -> to an image field.
  • TextToRender -> to a text/date/time/numeric field (this feature can be useful for rendering texts with special characters, or for preventing e-mails or other contact data automatic collection).
  • PictureUrl -> to a field containing the URL of an image file.

Screenshot - adv2.jpg

Other properties are self-explanatory:

  • ImageWidth
  • ImageHeight
  • ImageBorderStyle
  • ImageBorderWidth
  • ImageBorderColor
  • ImageToolTip
  • AlternateText
  • TextBackgroundColor
  • TextForeColor
  • TextFont

History

This project is hosted on the CodePlex site. The latest version can be found here.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

FF77
Software Developer (Senior)
Romania Romania
No Biography provided

You may also be interested in...

Comments and Discussions

 
GeneralV2 doesn't work with me Pin
anniejalbert9-Nov-07 3:48
memberanniejalbert9-Nov-07 3:48 
GeneralRe: V2 doesn't work with me Pin
FF7711-Nov-07 5:36
memberFF7711-Nov-07 5:36 
General... some code please Pin
gerrit.samson18-Sep-07 23:29
membergerrit.samson18-Sep-07 23:29 
GeneralRe: ... some code please [modified] Pin
FF7720-Sep-07 14:09
memberFF7720-Sep-07 14:09 
GeneralRe: ... some code please Pin
gerrit.samson20-Sep-07 20:06
membergerrit.samson20-Sep-07 20:06 
GeneralRe: ... some code please Pin
FF7723-Sep-07 22:06
memberFF7723-Sep-07 22:06 
GeneralRe: ... some code please Pin
gerrit.samson24-Sep-07 6:01
membergerrit.samson24-Sep-07 6:01 
GeneralComments Pin
FF7716-Jul-07 11:20
memberFF7716-Jul-07 11:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06 | 2.8.190417.4 | Last Updated 15 Jul 2007
Article Copyright 2007 by FF77
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid