<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://isom.uoregon.edu/community/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>Duck Bytes : Images</title><link>http://isom.uoregon.edu/community/blogs/castner/archive/tags/Images/default.aspx</link><description>Tags: Images</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Database driven images in ASP.NET GridView</title><link>http://isom.uoregon.edu/community/blogs/castner/archive/2007/03/08/Database-driven-images-in-ASP.NET-2-GridView.aspx</link><pubDate>Thu, 08 Mar 2007 16:35:00 GMT</pubDate><guid isPermaLink="false">4ac6e2ff-a44c-42df-b503-9719f53eb121:762</guid><dc:creator>gcastner</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://isom.uoregon.edu/community/blogs/castner/rsscomments.aspx?PostID=762</wfw:commentRss><comments>http://isom.uoregon.edu/community/blogs/castner/archive/2007/03/08/Database-driven-images-in-ASP.NET-2-GridView.aspx#comments</comments><description>&lt;p&gt;If you want to show images of products, members, or anything else, one method is to store the image filename in a database field and then&amp;nbsp;add&amp;nbsp;an imagefield column type to&amp;nbsp;an ASP.NET&amp;nbsp;gridview. Here are the steps:&lt;/p&gt;
&lt;p&gt;1. Let&amp;#39;s assume you have a &lt;em&gt;products&lt;/em&gt; table in an Access database (the step are almost identical for MSSQL) with a column called &lt;em&gt;product_image &lt;/em&gt;that stores image filenames such as &lt;em&gt;product1.jpg&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;2. Let&amp;#39;s also assume that you have saved all of your product images to a folder called &lt;em&gt;images&lt;/em&gt; in your web site.&lt;/p&gt;
&lt;p&gt;3. In Visual Web Developer or Visual Studio, create a &lt;strong&gt;GridView&lt;/strong&gt; based on the products table in the normal way.&lt;/p&gt;
&lt;p&gt;4. From GridView Tasks, Select &lt;strong&gt;Add New Column&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;5. For Field Type, select &lt;strong&gt;ImageField&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;6. Type in a Header if you want.&lt;/p&gt;
&lt;p&gt;7. For the data field, type in &lt;em&gt;product_image &lt;/em&gt;(or whatever you called your images field in the database).&lt;/p&gt;
&lt;p&gt;8. For the URL format string, type in &lt;em&gt;images/{0}&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In step 8, images refers to the folder in your web site where you saved all of your images.&lt;/p&gt;
&lt;p&gt;When you view your web page,&amp;nbsp;the {0} is replaced by the relevant image filename and then converted into an img HTML tag so that it displays as an image.&lt;/p&gt;&lt;img src="http://isom.uoregon.edu/community/aggbug.aspx?PostID=762" width="1" height="1"&gt;</description><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/GridView/default.aspx">GridView</category><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://isom.uoregon.edu/community/blogs/castner/archive/tags/Images/default.aspx">Images</category></item></channel></rss>