Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 December 14th, 2008, 10:21 PM
Registered User
 
Join Date: Nov 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch. 4 Enable View State with FileUpload control

I checked the Enable View State using a FileUpload control using the same form that contains the calendar with "Set Date" and "Plain PostBack" buttons. I expected that the value would stay filled-in after a file was selected using the Browse button, but instead it was blanked out. What would cause this value to be blanked out? Both the website and the page itself were set to Enable View State = true.

Also, when I just type letters into the text box on the FileUpload control, and not an actual path or filename, it causes a page error when any postback event gets triggered. Curious as to what causes that to happen on the server, although this might be talked about later in the book.

Thanks for your help!
Gerry
 
Old December 15th, 2008, 03:22 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

This is a limitation of the FileUpload control. Or rather, of the <input type="file" /> that it generates. You can not set the upload box to a value (not when the page loads and not when it posts back) as this would be a great security risk. You could prepopulate the box with an important file and trick users into sending it to you.

Did you check the PostedFile property of the FileUpload control? I think it's null / Nothing if you don't enter a valid file name.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!

Last edited by Imar; June 20th, 2009 at 08:44 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
FileUpload control aliirfan84 ASP.NET 2.0 Professional 1 June 2nd, 2007 03:37 PM
Javascript and View State VictorVictor ASP.NET 2.0 Professional 8 April 2nd, 2007 02:34 PM
FileUpload Control MunishBhatia ASP.NET 2.0 Basics 2 December 6th, 2006 04:03 AM
Session State|View State|Do I have other options? rockon ASP.NET 1.x and 2.0 Application Design 2 October 5th, 2005 07:10 PM
how to enable the design view yylee Access VBA 2 October 4th, 2004 02:23 PM





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