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).

fileupload.hasfile

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

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -