PDA

View Full Version : [CLOSED] Is there a way to click the textfield portion of the FileUploadField to get the file upload dialog?



michaeld
Jul 31, 2013, 7:53 AM
I want the user to be able to click the textfield portion to load the upload file dialog in the same was as clicking the browse button works. Can you provide a sample how I could do this?

Daniil
Jul 31, 2013, 11:50 AM
Hi @michaeld,

This appears to be working as you need in IE9, FireFox and Chrome.

Example

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET v2 Example</title>

<script>
var onAfterRender = function (fieldUploadField) {
fieldUploadField.inputEl.on("click", function () {
this.dom.click();
}, fieldUploadField.fileInputEl)
};
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:FileUploadField ID="FileUploadField1" runat="server">
<Listeners>
<AfterRender Fn="onAfterRender" />
</Listeners>
</ext:FileUploadField>
</form>
</body>
</html>

michaeld
Aug 02, 2013, 2:43 AM
Thank you!