Can you create custom events?

Mondeo

Centurion
Joined
Nov 10, 2006
Messages
128
Location
Sunny Lancashire
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
 
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):

Code:
<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
 
Back
Top