IS THERE A WAY TO CHECK FILEUPLOAD HAS FILE OR NOT IN CLIENT SIDE.IF IT HAS I WANT TO ENABLE BUTTON

Nattapong Unaregul

Total Post:3

Points:21
Posted by  Nattapong Unaregul
VB.Net 
 6643  View(s)
Ratings:
Rate this:
Here is my code in default.aspx .The default.aspx is in the content place
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
   <tr> <td><asp:FileUpload ID="FileUpload1" runat="server" " /></td>
           <td> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Task cannot be blank"
        InitialValue="" ControlToValidate="FileUpload1"> </asp:RequiredFieldValidator></td></tr>
   <tr><td><asp:Button ID="SaveBT" runat="server" Text="Button" Enable = "False"  /></td></tr> 
  </table>    
  

</asp:Content>


  1.   Modified On Mar-18-2016 06:14:21 AM
  1. Nattapong Unaregul

    Post:3

    Points:21
    Re: Is there a way to check Fileupload has file or not in client side.If It has i want to enable button

    Thank for your advice.Here is my solution


    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <asp:FileUpload ID="FileUpload1" runat="server" onchange="FileUpload_OnChange(this,event);"   />  &nbsp; &nbsp; &nbsp;
    <table>
       <tr>  <td> <input type="button" value = "Preview" /></td> </tr> 
        </table>
        
        <script  language="javascript" type ="text/javascript" >
            function Alert(myButton) {
                alert(myButton)
    }
                function changeColor(myButton) {
                myButton.value = "OK";
            }
            function FileUpload_OnChange(sender, e) {


                document.getElementById('<%=Button1.ClientID %>').disabled = false;
            }
        </script>
    </asp:Content>

      Modified On Mar-18-2016 06:14:49 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!