Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Iam using VS2015. Now Iam preparing a small project in ASP.Net. Iam using a control FileUpload.
ASPX - Page
<asp:FileUpload ID="FileUpload1" runat="server" ClientIDMode="Static" onchange="this.form.submit()" BackColor="Purple" style="font:20px calibri; border:5px solid blue; Width:100%; Height:100%;"/>

ASPX.CS PAGELOAD
String MyExcelFile = FileUpload1.PostedFile.FileName;


The problem is after executing this above statement, the FileUpload1 clearing the Text value. So is it possible to display the readed file in FileUpload1.

Thanks Regarads
Paraman

What I have tried:

I try to avoid FileUpload Text clearing
Posted
Updated 7-Aug-17 16:47pm
v2
Comments
F-ES Sitecore 8-Aug-17 4:17am    
It's not possible due to security reasons. If you explain your overall aims someone may be able to help you come up with a solution.
ZurdoDev 8-Aug-17 9:19am    
When I use it, the value stays. Do you have ViewState off perhaps?
Paramu1973 8-Aug-17 9:23am    
Thanks, I don't know what is with security, but I know windows forms OpenFileDialog() to read a file. Now preparing a interview project in WebForms. I need to read a file & it should not get clear the text, after to read. Thanks!
[no name] 8-Aug-17 11:15am    
Take a look at this example http://asp.net-tutorials.com/controls/file-upload-control/ - I think your question is not clear, are you just having problems getting the contents of the uploaded file?
Paramu1973 8-Aug-17 21:19pm    
Thanks. No Iam looking for FileUpload only. It's not required to have Upload button & Label. I need to use FileUpload only but the content of browse textbox should not clear. Thanks again

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900