<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx</link><description>I'm posting a sample project that shows some custom field template controls for Dynamic Data that allow images to be viewed/edited from a database. The sample also shows how you can view images that have their filenames in the database but the images</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>W&amp;ouml;chentliche Rundablage: LINQ to SQL, System.AddIns, WPF, C#, OpenID, SharePoint, ASP.NET AJAX | Code-Inside Blog</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#7291989</link><pubDate>Mon, 28 Jan 2008 22:41:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7291989</guid><dc:creator>Wöchentliche Rundablage: LINQ to SQL, System.AddIns, WPF, C#, OpenID, SharePoint, ASP.NET AJAX | Code-Inside Blog</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://code-inside.de/blog/2008/01/28/wchentliche-rundablage-linq-to-sql-systemaddins-wpf-c-openid-sharepoint-aspnet-ajax/"&gt;http://code-inside.de/blog/2008/01/28/wchentliche-rundablage-linq-to-sql-systemaddins-wpf-c-openid-sharepoint-aspnet-ajax/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Project templates just got bigger</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#7927033</link><pubDate>Thu, 28 Feb 2008 05:11:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7927033</guid><dc:creator>Marcin On ASP.NET</dc:creator><description>&lt;p&gt;One of the new things we are working on in ASP.NET is not directly connected to the new and improved&lt;/p&gt;
</description></item><item><title>re: Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#8449421</link><pubDate>Fri, 02 May 2008 09:43:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8449421</guid><dc:creator>Justice</dc:creator><description>&lt;p&gt;I really liked your post. &amp;nbsp;I found a couple of issues. &amp;nbsp;They could just be me, but these are the issues I ran into, and the solutions (probably not the greatest, but functioning). &amp;nbsp;1) I had issues with uniqueidentifiers for PKs&lt;/p&gt;
&lt;p&gt;2) I had an issue with empty Data / no cache key&lt;/p&gt;
&lt;p&gt;Thank you for the cool post. &amp;nbsp;Keep it up!&lt;/p&gt;
&lt;p&gt;//LinqImageHelper&lt;/p&gt;
&lt;p&gt;object value = null;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (member.Type == typeof(Guid))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;value = new Guid(primarykeyvalue);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;value = Convert.ChangeType(primarykeyvalue, member.Type, CultureInfo.InvariantCulture);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;// DBImage_Edit&lt;/p&gt;
&lt;p&gt;if (MetadataAttributes.TryGetValue(&amp;quot;ImageFormat&amp;quot;, out metadata))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string tablename = MetaMember.MetaTable.Name;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string primarykeyname = MetaMember.MetaTable.IdentityMetaMembers[0].Name;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string primarykeyvalue = DataBinder.GetPropertyValue(DataItem, primarykeyname).ToString();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string cachekey = string.Format(&amp;quot;{0}:{1}:{2}&amp;quot;, tablename, DataField, primarykeyvalue);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ViewState[&amp;quot;CacheKey&amp;quot;] = cachekey;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//check if image exists&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (DataValue == null || metadata == null)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SavedDataValue = DataValue;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//metadata&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int width = 100;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int height = 100;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool displayinedit = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;IDictionary&amp;lt;string, object&amp;gt; metadatadict = (IDictionary&amp;lt;string, object&amp;gt;)metadata;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;width = (int)metadatadict[&amp;quot;Width&amp;quot;];&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;height = (int)metadatadict[&amp;quot;Height&amp;quot;];&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;displayinedit = (bool)metadatadict[&amp;quot;DisplayInEdit&amp;quot;];&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//display picture if in edit mode, &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (TemplateMode == DynamicTemplateMode.EditItemTemplate &amp;amp;&amp;amp; displayinedit)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//set image properties&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PlaceHolderImage.Visible = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ImageEdit.ImageUrl = &amp;quot;~/ImageHandler.ashx?table=&amp;quot; + tablename + &amp;quot;&amp;amp;column=&amp;quot; + DataField + &amp;quot;&amp;amp;pkv=&amp;quot; + primarykeyvalue + &amp;quot;&amp;amp;width=&amp;quot; + width.ToString() + &amp;quot;&amp;amp;height=&amp;quot; + height.ToString();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
</description></item><item><title>re: Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#8501777</link><pubDate>Wed, 14 May 2008 00:20:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8501777</guid><dc:creator>Bryan Reynolds</dc:creator><description>&lt;p&gt;Are you planning on making a generic file handler?&lt;/p&gt;
</description></item><item><title>re: Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#8519350</link><pubDate>Mon, 19 May 2008 20:41:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8519350</guid><dc:creator>Jeff</dc:creator><description>&lt;p&gt;the MetadataAttribues.TryGetValue is causing an error for me.&lt;/p&gt;
</description></item><item><title>Dynamic Data DbImage SampleUpdated</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#8610210</link><pubDate>Tue, 17 Jun 2008 12:07:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8610210</guid><dc:creator>Scott Hunter</dc:creator><description>&lt;p&gt;I posted a sample back in January on how to display images from databases or the file system using Dynamic&lt;/p&gt;
</description></item><item><title>re: Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#8744935</link><pubDate>Thu, 17 Jul 2008 23:51:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8744935</guid><dc:creator>Andrei</dc:creator><description>&lt;p&gt;I cannot compile DbImageAPI in VS 2008 (without SP1) with 3.5 Beta framework.&lt;/p&gt;
&lt;p&gt;I got the following errors:&lt;/p&gt;
&lt;p&gt;The type or namespace name 'BaseMetadataAttribute' could not be found (are you missing a using directive or an assembly reference?)&lt;/p&gt;
&lt;p&gt;The type or namespace name 'ValidationAttribute' could not be found (are you missing a using directive or an assembly reference?&lt;/p&gt;
&lt;p&gt;What could be wrong?&lt;/p&gt;
&lt;p&gt;Nice example,&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
</description></item><item><title>re: Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#9014619</link><pubDate>Fri, 24 Oct 2008 15:36:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9014619</guid><dc:creator>chosenek</dc:creator><description>&lt;p&gt;Nice one Scott. But its made for extension CTP? I got SP1 and can't compile it. It needs 3.6 extension. But in sp1 is 3.5. &lt;/p&gt;
</description></item><item><title>re: Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#9057303</link><pubDate>Mon, 10 Nov 2008 15:28:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9057303</guid><dc:creator>Carlos Pinto</dc:creator><description>&lt;p&gt;I work on VB and in my case I only see the original images in DB, but updating and inserting new ones, not work.&lt;/p&gt;
&lt;p&gt;Ps- You had any version in VB?&lt;/p&gt;
</description></item><item><title>re: Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#9484374</link><pubDate>Tue, 17 Mar 2009 21:36:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9484374</guid><dc:creator>Johua</dc:creator><description>&lt;p&gt;Can anyone tell me where can I find ImageHandler.ashx&lt;/p&gt;
</description></item><item><title>re: Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#9498085</link><pubDate>Sun, 22 Mar 2009 13:29:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9498085</guid><dc:creator>Peter</dc:creator><description>&lt;p&gt;How do we fix the code i cant seem to find &lt;/p&gt;
&lt;p&gt;BaseMetadataAttribute and this is the only tutorial around..&lt;/p&gt;
</description></item><item><title>re: Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#9902545</link><pubDate>Fri, 02 Oct 2009 22:31:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9902545</guid><dc:creator>Rob</dc:creator><description>&lt;p&gt;This is great!&lt;/p&gt;
&lt;p&gt;Once files are attached as dbimage or linked to the filesystem for instance PDF, do you know a way to call that PDF into an RDLC report as an image frame along with other data fields from the table(s)?&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
</description></item><item><title>re: Sample for Displaying Images from the Database using Dynamic Data</title><link>http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx#9934028</link><pubDate>Tue, 08 Dec 2009 14:06:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9934028</guid><dc:creator>Ralf</dc:creator><description>&lt;p&gt;Maybe you build this example with CTP release?&lt;/p&gt;
&lt;p&gt;I try to update the example with SP1 and the hints from&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.asp.net/"&gt;http://www.asp.net/&lt;/a&gt;(S(ywiyuluxr3qb2dfva1z5lgeg))/downloads/3.5-SP1/Readme/&lt;/p&gt;
&lt;p&gt;but it still wont compile.&lt;/p&gt;
&lt;p&gt;Here are my errors:&lt;/p&gt;
&lt;p&gt;The type or namespace name 'BaseMetadataAttribute' could not be found (are you missing a using directive or an assembly reference?) ImageUrlAttribute.cs DbImageAPI&lt;/p&gt;
&lt;p&gt;The type or namespace name 'ValidationAttribute' could not be found (are you missing a using directive or an assembly reference?) ImageFormat.Attribute.cs DbImageAPI&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Ralf &lt;/p&gt;
</description></item></channel></rss>