Introduction:
In this article I will explain how to change or increase the textbox height dynamically using asp.net
In this article I will explain how to change or increase the textbox height dynamically using asp.net
Description:
I have one textbox my requirement is if user enters text in texbox that height of textbox needs to be adjusting with text for that I have written one JavaScript function to adjust textbox height here one more point is we need to set the TextMode="MultiLine" property for textbox to adjust textbox height
I have one textbox my requirement is if user enters text in texbox that height of textbox needs to be adjusting with text for that I have written one JavaScript function to adjust textbox height here one more point is we need to set the TextMode="MultiLine" property for textbox to adjust textbox height
Now design your aspx page like this
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Automatic Resize TextBoxtitle>
<script type="text/javascript">
function setHeight(txtdesc) {
txtdesc.style.height = txtdesc.scrollHeight + "px";
}
script>
head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="txtDesc" runat= "server" TextMode="MultiLine" onkeyup="setHeight(this);"onkeydown="setHeight(this);" />
</form>
</body>
</html>
| |
No comments:
Post a Comment