Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 15, 2008 12:02 AM by scothu
Dec 22, 2007 02:55 PM|LINK
I'm developing a Dynamic Image Control to be used within a dynamic data site. My worry is with the asp.net image control I will be using as the base control. I want to be able to create this control without having to call another page in order to display
the image. The only input for the asp.net image control is the ImageURL. I will be reading binary data from a database as my source for the image control. However, the only examples I've seen of this create a seperate .aspx page to use as the ImageURL for
the control. I am also worried that this will cause a sizing issue when the control is displayed within the DynamicGridView. Does anyone have any pointers or suggestions to make this development less of a headache?
Dec 22, 2007 06:47 PM|LINK
You can download a sample project that adds new FieldTemplate controls for accessing images from both the database and the file system. If you look in App_Code there is a Photo.cs which shows the proper attributes you need to put on the image field in your
database to get it to display. The control supports scaling the image and will allow uploading of images as well. I plan on having a detailed description of how this project was built and how to use it in my
blog after the holidays.
Here is a link to the sample to use before my blog post is live:
Dec 22, 2007 11:16 PM|LINK
I think this is going to handle exactly what I needed it to. I'll let you know if I have any trouble and I look forward to your blog after the holidays.
Dec 26, 2007 11:41 AM|LINK
just to add some input ... I've been able to get the image to show up but I guess I'm not able to use the image column as a foreign key ... I get an exception in ForeignKey.ascx saying I can only have STRING values as a foreign key ... so hoping that future
versions support binary data as foreign keys
Dec 26, 2007 07:07 PM|LINK
To make sure there is no misunderstanding, are you using the term 'image' in the 'picture' sense, or in the generic 'binary data' sense? Since you say that you got the image to show up, it sounds like you mean 'picture'. But on the other hand, you also
mention it's a foreign key, which makes it more sense like it's a small amount of binary data (since a picture would not be used as a foreign key). Can you clarify?
Dec 29, 2007 07:49 PM|LINK
actually what I meant was I can't do this:
column "picture" being binary data, it throws an exception saying the column has to be a string ... and the only other column I have in the table is a primary key integer and it has a problem with that too
Dec 29, 2007 09:22 PM|LINK
I see. Yes, it shouldn't throw an exception. But on the other hand, I'm not sure what you expect to be displayed. It's binary data, so it is generally not easy to get a readable string from it.
Jan 06, 2008 04:52 AM|LINK
Wouldn't the exception go away if there was at least one character field in the table that holds the picture. Maybe a descriptiion of the picture?
Jan 06, 2008 07:02 AM|LINK
Yes, if you had a string column and you don't specify the DisplayColumn("Picture") attribute, then that string column would be used for display by default.
Jan 07, 2008 09:18 PM|LINK
Thank you for you post with example with DbImage DynamicDataField's control. I explored it too - very nice example. But i found two bugs:
1. When we select the same records in table (for example in Categories ) then the OnDataBinding(EventArgs e) don't work in second time and we get in result the list of categories without retrieved images from database into all rows of picture column of our
2. When we start the editing mode of the records but don't select any new picture by Brows button and then press occasionally Update command - the image of our picture disappears from the edited row of our table.
I see that it is not so hard bugs but i tried to find right way to fix it and found that it seems not so easy. Can you fix it into your new issue of blog?
Thank you a lot again, LukCAD