Oct 17 2006

Read-Only TextBox

Category:Bil@l @ 15:05

That is a nice trick to make a TextBox a read-only TextBox:

<asp:TextBox id="txtID" runat="server" onkeydown="return ProtectBox(event);" />

   <script language="javascript">
   <!--
    function ProtectBox(e)
    {
     return false;
    }
   //-->
   </script>

This way, the user won't be able to write anything in the TextBox!!

Hope you liked it!

Regards

Tags:

Comments are closed