Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a fileupload control on a page. I know it has a boolean property called HasFile.

 

Ideally I need an event to fire when the HasFile property changes, is this possible? Can I wire up a manual event to watch a property and fire when it changes?

 

Thanks

Posted

Since the file upload control isn't actually ASP-driven, it doesn't have an auto-postback feature. You will actually have to use JavaScript for this.

 

For example, your HTML would look like this (between the <body> and </body> tags):

 


<script type="text/javascript">

function DoThis(){

	alert("Hello");

}

</script>

<input type="file" onchange="DoThis()" />


 

If I'm right, I'm right. If I'm wrong, I'm wrong. But in my experience, this is the only way to get anything dynamic out of a File control.

 

Good luck, I hope this helps!

 

~Derek

Check out my blog! DevPaper.NET

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...