Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 31st, 2006, 02:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 428
Thanks: 57
Thanked 2 Times in 2 Posts
Default FileUpLoad to display selected graphic?

I have a page that allows the user to browse to a folder, select a graphic, and upload it to our server. I'd like to display the selected graphic for the user prior to upload to ensure it's the graphic they really want. This seems like a common and simple enough task, but I have been unable to find a way to do it.

I'd like to automatically display the graphic when it's selected, but there appears to be no event on the FileUpLoad control that fires when a file has been selected. And I've tried adding a View Graphic button, which successfully displayed the selected graphic. But the FileUpLoad object loses the selected file name in the post back, so the user has to reselect it to upload it.

Is there a way to accomplish this in native ASP.NET (i.e. - WITHOUT using any third party products)?
 
Old April 4th, 2006, 08:23 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Sure, handle the event on the client side so there is no need for postback
        FileUpload1.Attributes.Add("OnChange", "alert('Boo');" + Image1.UniqueID.Replace("$","_") + ".src=this.value;");


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================





Similar Threads
Thread Thread Starter Forum Replies Last Post
Selected value from dropdown menu wont display. mizjinx Classic ASP Databases 0 May 20th, 2007 08:24 PM
Datagrid - selected item display advice janetb ASP.NET 1.0 and 1.1 Basics 2 May 9th, 2006 02:56 PM
retrieve and display selected results babywind BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 February 11th, 2005 05:23 AM
display value of selected radio in the textbox hosefo81 Javascript How-To 1 February 1st, 2004 07:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.