Click here to Skip to main content
15,906,248 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: ASP.Net Pin
Nathan Minier26-Feb-16 1:29
professionalNathan Minier26-Feb-16 1:29 
AnswerRe: ASP.Net Pin
Manas_Kumar26-Feb-16 7:17
professionalManas_Kumar26-Feb-16 7:17 
AnswerRe: ASP.Net Pin
aarif moh shaikh26-Feb-16 21:00
professionalaarif moh shaikh26-Feb-16 21:00 
QuestionPass ViewModel to view twice Pin
Member 1204569224-Feb-16 23:29
Member 1204569224-Feb-16 23:29 
AnswerRe: Pass ViewModel to view twice Pin
Nathan Minier25-Feb-16 1:53
professionalNathan Minier25-Feb-16 1:53 
QuestionGet file size from File Upload from IE and Chrome Pin
indian14324-Feb-16 15:49
indian14324-Feb-16 15:49 
AnswerRe: Get file size from File Upload from IE and Chrome Pin
F-ES Sitecore25-Feb-16 0:46
professionalF-ES Sitecore25-Feb-16 0:46 
QuestionSet the file upload value Pin
indian14324-Feb-16 11:24
indian14324-Feb-16 11:24 
Hi All,

I am using ASP.Net file upload control, when no file selected it says "No file chosen" but when a user selects wrong file I am showing a prompt message that incorrect file. But after that I want to set the message of the file upload control as "No file chosen" again, instead it is showing me the wrong file name.

Can anybody please help me in that regards? Any help a code snippet, a link or even a suggestion helps.

Here is my code:
<script type="text/javascript">
        function ShowThumbnail() {<br />
            var aspFileUpload = document.getElementById("FileUpload1");
            var errorLabel = document.getElementById("ErrorLabel");

<pre>
        var fileName = aspFileUpload.value;
        var ext = fileName.substr(fileName.lastIndexOf('.') + 1).toLowerCase();

        if (ext == "docx" || ext == "doc" || ext == "pdf") {
            aspFileUpload.innerHTML = "";
            aspFileUpload.innerText = "";
            return true;
        }
        else {                             
            errorLabel.innerHTML = "Invalid image file, must select a *.doc, *.docx, or *.pdf file.";                
        }            
    }



<asp:fileupload id="FileUpload1" runat="server" onchange="ShowThumbnail();">
<asp:customvalidator id="customValidatorUpload" runat="server" errormessage="" controltovalidate="FileUpload1" clientvalidationfunction="ShowThumbnail();">
<asp:label id="lbl_uploadMessage" runat="server" text="">
<asp:label id="ErrorLabel" runat="server" text="">

Thanks,

Abdul Aleem

"There is already enough hatred in the world lets spread love, compassion and affection."

AnswerRe: Set the file upload value Pin
Richard Deeming25-Feb-16 2:21
mveRichard Deeming25-Feb-16 2:21 
Questionfile upload, restricting size and type of files Pin
indian14324-Feb-16 7:43
indian14324-Feb-16 7:43 
AnswerRe: file upload, restricting size and type of files Pin
Richard Deeming24-Feb-16 7:56
mveRichard Deeming24-Feb-16 7:56 
GeneralRe: file upload, restricting size and type of files Pin
indian14324-Feb-16 12:54
indian14324-Feb-16 12:54 
AnswerRe: file upload, restricting size and type of files Pin
F-ES Sitecore25-Feb-16 0:43
professionalF-ES Sitecore25-Feb-16 0:43 
QuestionHow to filter data in DataTable using like operator ? Pin
Member 1228492023-Feb-16 19:04
Member 1228492023-Feb-16 19:04 
QuestionRe: How to filter data in DataTable using like operator ? Pin
Richard MacCutchan23-Feb-16 21:32
mveRichard MacCutchan23-Feb-16 21:32 
AnswerRe: How to filter data in DataTable using like operator ? Pin
aarif moh shaikh26-Feb-16 21:04
professionalaarif moh shaikh26-Feb-16 21:04 
Questionhow to bind Database field value in textbox based on choosing dropdownlist selected value in asp.net MVC Pin
Nithu Nithiya23-Feb-16 18:06
professionalNithu Nithiya23-Feb-16 18:06 
AnswerRe: how to bind Database field value in textbox based on choosing dropdownlist selected value in asp.net MVC Pin
John C Rayan27-Feb-16 21:39
professionalJohn C Rayan27-Feb-16 21:39 
QuestionDownload file from memorystream by client side click Pin
indian14323-Feb-16 13:33
indian14323-Feb-16 13:33 
AnswerRe: Download file from memorystream by client side click Pin
Richard MacCutchan23-Feb-16 21:29
mveRichard MacCutchan23-Feb-16 21:29 
GeneralRe: Download file from memorystream by client side click Pin
indian14324-Feb-16 7:21
indian14324-Feb-16 7:21 
QuestionDropdownlist with Model (MVC4,C#, ASP.Net2015,Razor) Pin Pin
bl4ckeagle23-Feb-16 8:12
bl4ckeagle23-Feb-16 8:12 
QuestionFeedback form on my website to email feedback Pin
Member 1033668221-Feb-16 11:03
Member 1033668221-Feb-16 11:03 
AnswerRe: Feedback form on my website to email feedback Pin
Richard MacCutchan21-Feb-16 22:07
mveRichard MacCutchan21-Feb-16 22:07 
GeneralRe: Feedback form on my website to email feedback Pin
Member 1033668222-Feb-16 3:19
Member 1033668222-Feb-16 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.