c# - What is the use of hasfile()? is required field validator is enough? -
should need use hasfile() while uploading file in asp.net if use required field validater? use of hasfile?
requiredfieldvalidator
woudl useful on client side whereas fileupload.hasfile useful on server side (code behind).
the hasfile property gets value indicating whether fileupload control contains file upload. use property verify file upload exists before performing operations on file. example, before calling saveas method save file disk, use hasfile property verify file exists. if hasfile returns true, call saveas method. if returns false, display message user indicating control not contain file.
requiredfiledvalidator
indicate if has been entered in control or not.
its better practice check @ client server end, client's browser can have javascript disabled, in case requiredfieldvalidator
fail work.
Comments
Post a Comment