Asp – Retain value in fileupload control

asp.netfile upload

I am writing a file upload application. So it contains a keyname in textbox and a fileupload
control. A save button is used to save the keyname and the file. My issue is when I select a file in fileupload control and I donot enter any value in keyname textbox and click on save button, a message is shown 'enter a keyname' but the fileupload control is cleared. How can retain the value in the fileupload control?

Best Answer

You can't retain value in FileUpload control. This is because of security reasons. you can use RequiredFieldValidator for keyname textbox.

Related Topic