Thursday, 30 October 2014

Disable resize for ASP.Net Multiline TextBox

Here I am example, how to disable resize i.e. prevent resizing of the ASP.Net Multiline TextBox due to the resize grip in the bottom right corner using CSS3.
This works in all newer browsers such as Internet Explorer IE, Mozilla FireFox and Google Chrome


You can either do it by setting it directly in the style attribute.

Source 1:

<asp:TextBox ID="TextBox1" runat="server" TextMode = "MultiLine" style = "resize:none"></asp:TextBox>

Or make use of the CSS style sheet. If you want to disable resize for all the ASP.Net Multiline TextBoxes

Source 2:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        textarea
        {
            resize: none;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:TextBox ID="TextBox2" runat="server" TextMode = "MultiLine"></asp:TextBox>
    </form>
</body>
</html>

No comments:

Post a Comment