<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/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>ASP.NET Dynamic Data</title><link>http://forums.asp.net/1145.aspx</link><description>Discussions regarding the new scaffolding framework in ASP.NET</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274871.aspx</link><pubDate>Sat, 04 Jul 2009 18:04:30 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274871</guid><dc:creator>msingareddy</dc:creator><author>msingareddy</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274871.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274871</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thanks Steve. that worked! Instead of making the change to the LinQExpressionHelp class I made the change directly in the handler class. Now I&amp;#39;m able to upload and download files from database.&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;var whereCall = LinqExpressionHelper.BuildItemsQuery(query, 
metaTable,cols,primaryKeyValues.ToArray());

var singleWhereCall = Expression.Call(typeof(Queryable), &amp;quot;FirstOrDefault&amp;quot;, new Type[] { metaTable.EntityType }, whereCall); 

//var singleWhereCall = LinqExpressionHelper.BuildSingleItemQuery(query, metaTable, primaryKeyValues.ToArray());

// Items.Where(row =&amp;gt; row.ID == 1).Single().Picture
var fileBytes = Expression.Property(singleWhereCall, column);&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;I&amp;#39;ve marked your reply as answer.&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274849.aspx</link><pubDate>Sat, 04 Jul 2009 17:12:52 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274849</guid><dc:creator>sjnaughton</dc:creator><author>sjnaughton</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274849.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274849</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Yes of course, you will need to go to the LinqExpressionHelp class and edit this&amp;nbsp;method &lt;br /&gt;(in the &lt;a id="ctl00_ctl00_MasterContent_Content_ProjectReleasesSidebar_Sidebar_ReleaseTypeRepeater_ctl00_ReleaseRepeater_ctl15_ReleaseLink" title="Dynamic Data Futures VS2008 SP1 RTM" href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=14475"&gt;Dynamic Data Futures VS2008 SP1 RTM&lt;/a&gt;&amp;nbsp;project&amp;nbsp;&lt;span id="ctl00_ctl00_MasterContent_Content_ProjectReleasesSidebar_Sidebar_ReleaseTypeRepeater_ctl00_ReleaseRepeater_ctl15_ReleaseDateTime"&gt;Jun 17 2008&lt;/span&gt;, Stable):&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;public static MethodCallExpression BuildSingleItemQuery(IQueryable query, MetaTable metaTable, string[] primaryKeyValues)
{
    // Items.Where(row =&amp;gt; row.ID == 1)
    var whereCall = BuildItemsQuery(query, metaTable, metaTable.PrimaryKeyColumns, primaryKeyValues);
    // Items.Where(row =&amp;gt; row.ID == 1).Single()
    var singleCall = Expression.Call(typeof(Queryable), &amp;quot;Single&amp;quot;, new Type[] { metaTable.EntityType }, whereCall);

    return singleCall;
}&lt;/pre&gt;
&lt;p&gt;and change the &lt;strong&gt;Single&lt;/strong&gt; to &lt;strong&gt;First&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;P.S. there could be others that need changing.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274844.aspx</link><pubDate>Sat, 04 Jul 2009 16:59:52 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274844</guid><dc:creator>msingareddy</dc:creator><author>msingareddy</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274844.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274844</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Yes I need to use FirstOrDefault. Can you show me how I can modify the above code to use that?&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274839.aspx</link><pubDate>Sat, 04 Jul 2009 16:54:56 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274839</guid><dc:creator>sjnaughton</dc:creator><author>sjnaughton</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274839.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274839</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Yes that&amp;#39;s a common issue going from L2S to EF EF does not support Single or SingleOrDefault you will need to change it to First or FirstOrDefault.&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274804.aspx</link><pubDate>Sat, 04 Jul 2009 16:13:01 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274804</guid><dc:creator>msingareddy</dc:creator><author>msingareddy</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274804.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274804</wfw:commentRss><description>&lt;p&gt;&lt;font face="Times New Roman" size="3"&gt;Thanks Steve, that was it. I&amp;nbsp;registered the handler in web.config and I was able to invoke&amp;nbsp;my FileHandler.axd code. However I&amp;#39;m running into another issue. I&amp;#39;m using EF and I&amp;#39;m running into the following error when using DbImage sample. &lt;/font&gt;&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;// Items.Where(row =&amp;gt; row.ID == 1).Single()

var singleWhereCall = LinqExpressionHelper.BuildSingleItemQuery(query, metaTable, primaryKeyValues.ToArray());

// Items.Where(row =&amp;gt; row.ID == 1).Single().Picture
var fileBytes = Expression.Property(singleWhereCall, column);

object file = query.Provider.Execute(fileBytes);
            &lt;/pre&gt;
&lt;p&gt;The error :&lt;/p&gt;
&lt;p&gt;The method &amp;#39;Single&amp;#39; is not supported by LINQ to Entities. Consider using the method &amp;#39;First&amp;#39; instead.&lt;/p&gt;
&lt;p&gt;How can I change the above LINQ query to adapt to Linq to Entities?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274508.aspx</link><pubDate>Sat, 04 Jul 2009 09:23:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274508</guid><dc:creator>sjnaughton</dc:creator><author>sjnaughton</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274508.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274508</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi Msingareddy, have you looked at Scott Hunter original article here:&lt;a href="http://blogs.msdn.com/scothu/archive/2008/01/14/sample.aspx"&gt; Sample for Displaying Images from the Database using Dynamic Data&lt;/a&gt;. I&amp;#39;m not sure how you have implemented your FileHandler.axd if it is not a phisical file then you may need to add a route i.e.:&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;// Create a special escape route for handling resource requests. &lt;br /&gt;// The this route will be evaluated for all requests but the
// contraint will only match requests with WebResource.axd on the end.
// The StopRoutingHandler will instruct the routing system to stop &lt;br /&gt;// processing this request and pass&lt;br /&gt;// it on to standard ASP.NET processing.
routes.Add(new Route(&amp;quot;{*resource}&amp;quot;, new StopRoutingHandler())
{
    Constraints = new RouteValueDictionary(new { resource = @&amp;quot;.*WebResource\.axd&amp;quot; })
});&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;Like the one for the resource handler in the DD Futures project.&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274197.aspx</link><pubDate>Sat, 04 Jul 2009 04:04:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274197</guid><dc:creator>mudassarkhan</dc:creator><author>mudassarkhan</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274197.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274197</wfw:commentRss><description>&lt;p&gt;try these &lt;/p&gt;
&lt;p&gt;Save Files&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.aspsnippets.com/post/2009/04/08/Save-Files-to-SQL-Server-Database-using-FileUpload-Control.aspx"&gt;http://www.aspsnippets.com/post/2009/04/08/Save-Files-to-SQL-Server-Database-using-FileUpload-Control.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.aspsnippets.com/post/2009/02/19/Save-and-Retrieve-Files-from-SQL-Server-Database-using-ASPNet.aspx"&gt;http://www.aspsnippets.com/post/2009/02/19/Save-and-Retrieve-Files-from-SQL-Server-Database-using-ASPNet.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Display images stored in database&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.aspsnippets.com/post/2009/02/21/Display-Images-from-Database-using-ASPNet.aspx"&gt;http://www.aspsnippets.com/post/2009/02/21/Display-Images-from-Database-using-ASPNet.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.aspsnippets.com/post/2009/04/20/Display-images-from-SQL-Server-Database-in-ASPNet-GridView-control.aspx"&gt;http://www.aspsnippets.com/post/2009/04/20/Display-images-from-SQL-Server-Database-in-ASPNet-GridView-control.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274182.aspx</link><pubDate>Sat, 04 Jul 2009 03:40:24 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274182</guid><dc:creator>msingareddy</dc:creator><author>msingareddy</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274182.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274182</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thanks Steve, I&amp;#39;ve already looked at this and I&amp;#39;m trying to adapt DbImage sample from the futures to accomplish what I want. I&amp;#39;m having trouble invoking my custom FileHandler. &lt;/p&gt;
&lt;p&gt;I have create a custom FeildTemplate called FileImage and added a custom HttpHandler called FileHandler to the App_code folder. But when I set the ImageUrl to &amp;quot;~/FileHandler.axd?Table=xxxx&amp;amp;Field=yyyy&amp;amp;pk=1.....&amp;quot;, the processRequest() method never gets invoked. When I manually type in the URL as&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.myapp.com/FileHandler.axd?Table=xxxx&amp;amp;Field=yyyy&amp;amp;pk=1"&gt;http://www.myapp.com/FileHandler.axd?Table=xxxx&amp;amp;Field=yyyy&amp;amp;pk=1&lt;/a&gt;....., I get a &amp;quot;Resouce not found&amp;quot; error.&lt;/p&gt;
&lt;p&gt;Can you please point what I&amp;#39;m doing wrong?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274022.aspx</link><pubDate>Fri, 03 Jul 2009 21:39:39 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274022</guid><dc:creator>sjnaughton</dc:creator><author>sjnaughton</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274022.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274022</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Well then you can use the DBImage to effect this.&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274012.aspx</link><pubDate>Fri, 03 Jul 2009 21:21:27 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274012</guid><dc:creator>hans_v</dc:creator><author>hans_v</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274012.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274012</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;a href="http://www.4guysfromrolla.com/articles/120606-1.aspx"&gt;http://www.4guysfromrolla.com/articles/120606-1.aspx&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3274010.aspx</link><pubDate>Fri, 03 Jul 2009 21:14:29 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3274010</guid><dc:creator>msingareddy</dc:creator><author>msingareddy</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3274010.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3274010</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi Steve,&lt;/p&gt;
&lt;p&gt;I see that in your example, you are saving the files to the file system. I need something that saves the file to the database and retrieves it.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3273055.aspx</link><pubDate>Fri, 03 Jul 2009 08:30:10 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3273055</guid><dc:creator>sjnaughton</dc:creator><author>sjnaughton</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3273055.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3273055</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi Msingareddy, have a look at my file upload field template here: &lt;a name="7459830534023549612"&gt;&lt;/a&gt;&lt;a href="http://csharpbits.notaclue.net/2008/09/dynamic-data-part-3-fileupload.html"&gt;Dynamic Data: Part 3-FileUpload FieldTemplates&lt;/a&gt;&lt;/p&gt;</description></item><item><title>FileUpload to database (doc, xls, pdf, picture, etc.)</title><link>http://forums.asp.net/thread/3272322.aspx</link><pubDate>Thu, 02 Jul 2009 21:57:02 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3272322</guid><dc:creator>msingareddy</dc:creator><author>msingareddy</author><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3272322.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1145&amp;PostID=3272322</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi, &lt;/p&gt;
&lt;p&gt;I need to upload any file (picture, doc, pdf, excel etc.) &amp;nbsp;to the database. In display mode, I need to display the file name with a hyperlink. When this hyperlink is clicked the file should be downloaded from the database and displayed (embedded in the browser) or promt for saving it. When in edit mode, both the link and file upload control should be displayed to enable replacing the original file or inserting a new file.&lt;/p&gt;
&lt;p&gt;I have looked at DBImage and FileUpload examples but they are not&amp;nbsp;quite the same to what I&amp;#39;m looking for. The Dbimage fieldtemplate does this only for the images/pcitures.&amp;nbsp;The&amp;nbsp;FileUpload fieldtemplates&amp;nbsp;upload the files to a central file system and not to the database.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>