Wednesday, May 29, 2013

Javascript for enabled/disabled textbox when select others in dropdownlist

<asp:TextBox ID="txtid" runat="server"></asp:TextBox>
 
<asp:DropDownList ID="ddlid" runat="server" onchange="showReadonly();">
<asp:ListItem Text="Select" />
<asp:ListItem Text="English" />
<asp:ListItem Text="Other Course" />
</asp:DropDownList>


<script type="text/javascript">
      function showReadonly() {
     
          var txtobj = document.getElementById('<%=txtid.ClientID%>');
          var valobj1 = document.getElementById('<%=ddlid.ClientID%>').value;
     
          if (valobj1 == "Other Course") {
              txtobj.disabled = false;
              txtobj.focus();
          }
          else {
              txtobj.disabled = true;

          }
      }
</script>

If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website

0 comments:

Post a Comment