I have a asp Fileupload control on my aspx page as follows:
I have a asp button. On ClientClick of this button I am opening the fileupload control from javascript as follows:
---------javascript -------------
function OpenFileDialog() {
var result = document.getElementById(("<%=fu_Import.ClientID %>")).click();
return true;
}
The fielDialog opens properly , but when I select any file and Click on Open button in that FileDailog nothing happens. I mean the Onclick event of that Asp:Button is not called. Also the filename property of fileUpload control is not set.
protected void btnImportIdiomCSV_Click(object sender, EventArgs e)
{
try
{
if (fu_Import.PostedFile.FileName == string.Empty)
{
// Error meessage
}
else
{
// Do something
}