Sponsored By
DataConverter
Advertise with Us
Advertisement
Advertise with Us
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog
Report Abuse Form
Reason:    
   

Home >> .Net >> VB.Net >> Is there a way to check Fileupload has file or not in client side.If It has i want to enable button
Author Post

Nattapong Unaregul


Total Post: 3
Member Since: 7/20/2012
Points: 17
Is there a way to check Fileupload has file or not in client side.If It has i want to enable button
Posted On: 7/21/2012 12:02:35 AM
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>


Author Post

Arun Singh


Total Post: 48
Member Since: 7/1/2011
Points: 331
Re: Is there a way to check Fileupload has file or not in client side.If It has i want to enable button
Posted On: 7/21/2012 12:58:39 AM
Author Post

Nattapong Unaregul


Total Post: 3
Member Since: 7/20/2012
Points: 17
Re: Is there a way to check Fileupload has file or not in client side.If It has i want to enable button
Posted On: 7/22/2012 8:19:13 PM
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>
Report Abuse Form
Reason:    
 
Total Online Users: 2645
Advertisement
MindStick DataConverter
Advertise with Us
  
Copyright © 2009 - 2013MindStick. All Rights Reserved.