Dynamic Data DbImage SampleUpdated
I posted a sample back in January on how to display images from databases or the file system using Dynamic Data. You can view that post HERE. I've just updated that sample to fix some bugs and add some new functionality. You can download the latest version of DbImage from this link: DOWNLOAD DBIMAGE.
Here is a list of the changes and updates I've made since the original post:
1) Fixed an issue that caused DbImage not to work when the primary column for the table is a GUID.
2) Added support for compound primary keys (primary key that is more then one column in the table).
3) Added support for Entity Framework (previous release would display images in Entity Framework but fail to update them).
4) The asp:FileUpload control does not work correctly inside of UpdatePanels with partial rendering turned on. By default the templates in Dynamic Data are enclosed in UpdatePanels with partial rendering turned on. This means that uploading of images will fail unless partial rendering is disabled. The new sample adds a helper method call in the Page_Init of the Insert, Edit and ListDetails page templates. This helper call looks to see if any of the displayed columns are DbImage columns and if so turns off partial rendering for the page.
DbImageAPI.ImageHelper.DisablePartialRenderingForUpload(this, DetailsDataSource.GetTable());
Comments
Anonymous
June 16, 2008
PingBack from http://blog.a-foton.ru/2008/06/17/dynamic-data-dbimage-sampleupdated/Anonymous
June 16, 2008
PingBack from http://blog.a-foton.ru/2008/06/17/dynamic-data-dbimage-sampleupdated/Anonymous
June 17, 2008
Today, ASP.NET Dynamic Data moved from its current home on Code Gallery to its new home on CodePlex . Anonymous
June 28, 2008
I downloaded Extracted the files and ran the solution clicked view in browser and got these errors Error 1 No overload for method 'RegisterControl' takes '2' arguments C:UsersOwnerDocumentsDynamic DataDbImageAPIWebSiteDynamicDataPageTemplatesList.aspx.cs 19 9 C:...WebSite Error 2 No overload for method 'GetActionPath' takes '1' arguments C:UsersOwnerDocumentsDynamic DataDbImageAPIWebSiteDynamicDataPageTemplatesList.aspx.cs 26 39 C:...WebSiteAnonymous
June 28, 2008
I commented out the two Pre ceding errors now I'm grtting these Error 1 'BooleanField.DataControl': no suitable method found to override C:UsersOwnerDocumentsDynamic DataDbImageDbImageAPIWebSiteDynamicDataFieldTemplatesBoolean.ascx.cs 25 29 C:...WebSite Error 2 'ForeignKey_EditField.DataControl': no suitable method found to override C:UsersOwnerDocumentsDynamic DataDbImageDbImageAPIWebSiteDynamicDataFieldTemplatesForeignKey_Edit.ascx.cs 48 29 C:...WebSite Error 3 'MultilineText_EditField.DataControl': no suitable method found to override C:UsersOwnerDocumentsDynamic DataDbImageDbImageAPIWebSiteDynamicDataFieldTemplatesMultilineText_Edit.ascx.cs 30 Error 4 'Boolean_EditField.DataControl': no suitable method found to override C:UsersOwnerDocumentsDynamic DataDbImageDbImageAPIWebSiteDynamicDataFieldTemplatesBoolean_Edit.ascx.cs 29 Error 5 'ForeignKeyField.DataControl': no suitable method found to override C:UsersOwnerDocumentsDynamic DataDbImageDbImageAPIWebSiteDynamicDataFieldTemplatesForeignKey.ascx.cs 55 Error 6 'Integer_EditField.DataControl': no suitable method found to override C:UsersOwnerDocumentsDynamic DataDbImageDbImageAPIWebSiteDynamicDataFieldTemplatesInteger_Edit.ascx.cs 31 Error 7 'DateTime_EditField.DataControl': no suitable method found to override C:UsersOwnerDocumentsDynamic DataDbImageDbImageAPIWebSiteDynamicDataFieldTemplatesDateTime_Edit.ascx.cs 29 Error 8 'Decimal_EditField.DataControl': no suitable method found to override C:UsersOwnerDocumentsDynamic DataDbImageDbImageAPIWebSiteDynamicDataFieldTemplatesDecimal_Edit.ascx.cs 31 Error 9 'ChildrenField.DataControl': no suitable method found to override C:UsersOwnerDocumentsDynamic DataDbImageDbImageAPIWebSiteDynamicDataFieldTemplatesChildren.ascx.cs 55 Error 10 'DateTimeField.DataControl': no suitable method found to override C:UsersOwnerDocumentsDynamic DataDbImageDbImageAPIWebSiteDynamicDataFieldTemplatesDateTime.ascx.cs 17Anonymous
June 28, 2008
I downloaded the new Dynamic Data Runtime and Templates 5-23a Refresh and all seems to be goodAnonymous
June 30, 2008
The sample code does not work. I was getting this error: Error 1 'ChildrenField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesChildren.ascx.cs 55 29 C:...WebSite Error 2 'DateTimeField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesDateTime.ascx.cs 17 Error 3 'Decimal_EditField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesDecimal_Edit.ascx.cs 31 Error 4 'TextField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesText.ascx.cs 17 Error 5 'ForeignKey_EditField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesForeignKey_Edit.ascx.cs 48 Error 6 'Text_EditField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesText_Edit.ascx.cs 32 Error 7 'MultilineText_EditField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesMultilineText_Edit.ascx.cs 30 Error 8 'DateTime_EditField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesDateTime_Edit.ascx.cs 29 Error 9 'ForeignKeyField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesForeignKey.ascx.cs 55 Error 10 'Boolean_EditField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesBoolean_Edit.ascx.cs 29 Error 11 'BooleanField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesBoolean.ascx.cs 25 Error 12 'Integer_EditField.DataControl': no suitable method found to override C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesInteger_Edit.ascx.cs 31 As suggested I installed the new Dynamic Data Runtime and Templates 5-23a Refresh And now I am getting this error: Error 2 '$codebesideclassname$' is not a valid value for attribute 'inherits'. C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesDynamicDataField_cb.ascx 1 Error 3 '$safeitemrootname$' is not a valid value for attribute 'classname'. C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesDynamicDataField.ascx 1 Error 4 '$safeitemrootname$' is not a valid value for attribute 'classname'. C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesDynamicDataField_Edit.ascx 1 Error 5 The file '/WebSite/DynamicData/FieldTemplates/$codebehindclassname$_Edit.ascx.cs' does not exist. C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesDynamicDataField_Edit_cb.ascx 1 Error 6 '$codebesideclassname$_EditField' is not a valid value for attribute 'inherits'. C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesDynamicDataField_Edit_cb.ascx 1 Warning 7 File '$codebesiderootname$.cs' was not found. C:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesDynamicDataField_cb.ascx 1 61 C:...WebSite Error 8 The name 'FieldValueString' does not exist in the current context c:Documents and SettingstmahmudMy DocumentsVisual Studio 2008WebSitesDbImageAPIWebSiteDynamicDataFieldTemplatesDynamicDataField_cb.ascx 3 5 C:...WebSiteAnonymous
July 21, 2008
For the sample to work you will need to have the latest Dynamic Data Runtime installed. You can download that from here: http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14474. Also note that this sample has now been moved into the Dynamic Data Futures which you can download from: http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14475Anonymous
March 12, 2009
Hello, I downloaded the Dynamic Data Futures project and everything worked smoothly. However, I need to use the dbImage template for a website I'm developing but I cannot get this to work. The steps I followed are:
- Copy DbImage.ascx, DbImage_Edit.ascx and FileImage.ascx from the sample website and copied them into my project's FieldTemplate folder.
- Regenerate the dbml file.
- Add a Metadata Class for the table that has an Image column and place the following code: using System; using System.Collections.Generic; using System.Linq; using System.Xml.Linq; using System.Web.DynamicData; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls.WebParts; using System.ComponentModel.DataAnnotations; using System.ComponentModel.Design; using System.ComponentModel; [MetadataType(typeof(ImagenMetadata))] public partial class Imagen {} [TableName("Imagenes")] public class ImagenMetadata { // Show the image [UIHint("DbImage")] [DisplayName("Fotografía")] public object Archivo { get; set; } } Now when I try to edit or insert records into the table "Imagen", the file selector appears but when I select the image and clic on insert/update, an error shows up saying that I need to select an Image. I'm affraid I am a newby on Dynamic Data so I really do not know what am I doing wrong. Thank you in advance!
Anonymous
March 21, 2009
Scott, the DOWNLOAD DBIMAGE link no longer works. It shows this error: There was an error downloading the file. It may have been deleted from the server. If the DbImage stuff still available somewhere?Anonymous
March 27, 2009
Brilliant work! I finally got images into my dynamic data site database after trying numerous times!Anonymous
March 28, 2009
The comment has been removedAnonymous
March 28, 2009
The comment has been removedAnonymous
March 28, 2009
More on the problem it seems - FileUploadEdit.HasFile always returns false.... any reason for this?Anonymous
March 28, 2009
Okay more input.... im having real problems trying to integrate all your code into my existing project. When i move aspects of your code across to my project, i just get build failures on types all the time specially since i have to remove all the dynamic data futures namespace references in each file. When i try compile i just get a "could not find type Edit" After a whole bunch of waggling around i got the upload to work but the display wont...empty picture boxes.Anonymous
March 29, 2009
anyone managed to get this sample to work with ADO .NET entity model designer?Anonymous
June 29, 2009
There has not been a post on this since 3.20.09? After reading the comments it looks like it has possibilities. I have a project that I need this kind of functionality. I've got the System.core. 3.5. I also have installed the sp1 for VS. What are the system requirements for it to work ? ThanksAnonymous
December 04, 2010
<a href="www.gleamtech.com/.../asp-net-file-manager-control">asp.net file picker</a> FileUltimate is an ASP.NET file manager control which you can add directly to your existing ASP.NET (.aspx) pages. The control renders a user interface similar to "Windows Explorer" within the page and this user interface allows you to view the contents of the predefined root folders and allow complete file management actions within those folders. File management actions can be limited by predefined permissions and quota limits on each folder separately.Anonymous
December 04, 2010
www.gleamtech.com/.../asp-net-file-manager-control FileUltimate is an ASP.NET file manager control which you can add directly to your existing ASP.NET (.aspx) pages. The control renders a user interface similar to "Windows Explorer" within the page and this user interface allows you to view the contents of the predefined root folders and allow complete file management actions within those folders. File management actions can be limited by predefined permissions and quota limits on each folder separately.Anonymous
January 11, 2011
Hi Scott, I have the same problem of Dan: the DOWNLOAD DBIMAGE link no longer works. It shows this error: There was an error downloading the file. It may have been deleted from the server. With the previous version, I cannot save images on database.Anonymous
July 17, 2014
DbImage control does not when I register multiple context file, with different name, only it works with default context, ie data context