You cannot detect when it has a file, however you can detect length. If you wish to detect length, you need to make sure the box is READONLY. Cause, like me and probably a few others, I type most of my paths into the upload box. This you would have to do client side, so javascript would be best bet. Something like this:
function detectFile()
{
var idval = document.getElementById("servercontrol").value;
if (idval.length > 5)
{
if (idval.indexOf(":") && idval.indexOf(".")
{
document.getElementById("serversubmitbtn").click();
}
}
}
'put attributes on it:
ctrl.Attributes.Add("OnChange","retun detectFile()")
Now you need a button with this one, and you should always have it just incase javascript is disabled. What this does is checks to see if the length of your file upload control is greater than 5 (C:/ & .tag is easily over 5 combined, let alone the actual file name), if it is, it then checks to make sure that there is at least a colon and a period. You can change this extensively and use regex if you wish. Then it calls your submit button's onclick attribute dynamically.
Reputation Points: 43
Solved Threads: 68
Veteran Poster
Offline 1,080 posts
since Sep 2007