Friday, March 29, 2013

Asp .NET control Enable or Disable using javascript

==>>  Create a website in add new page  and paste the Code:--



1.  ASPX PAGE CODE:-  


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Asp .NET control Enable or Disable using  javascript</title>

    <script language="javascript" type="text/javascript">
       
        function ButtonStatus() {
            var txtvalue = document.getElementById('txtVal');

            if (txtvalue.value == "enable")
                document.getElementById('btnEnable').disabled = false;
            else
                document.getElementById('btnEnable').disabled = true;
        }
    </script>

</head>
<body>
    <div>
        <input type="text" id="txtVal" onkeyup="ButtonStatus(this,'btnEnable')" />
        <input type="button" id="btnEnable" value="Button" disabled="disabled" />
    </div>
</body>
</html>



Hope this will help you.....



































 

1 comment: