Auto Growing TextArea in ASP.NET

No.of Views2176
Bookmarked1 times
Downloads 
Votes0
By  ashraf   On  08 May 2010 06:05:11
Tag : ASP.NET , ASP.NET Controls
Auto Growing TextBox or TextArea in ASP.NET
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

Ehsan was telling me about the litte, simple and useful control.  All of us already seen that control in facebook chatting window. that textboox automatically bacome bigger according to the text written in the textbox.

Here is the demo of that JQuery http://www.aclevercookie.com/demos/autogrow_textarea.html

I have tested that in asp.net TextBox it works. Here is my code in asp.net for auto growing textbox.

Next you have to  download JQuery and JQuery Auto Grow to use it.

CodeLines

Just compose this code or copy paste in your html page to automatically grow your textbox which is marked class as "Expanding"

<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript" src="jquery.autogrow.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.expanding').autogrow();
});

<style type="text/css">
.expanding {line-height: 18px;}
</style>

<asp:TextBox ID="myTxt" runat="server" CssClass="expanding" AutoPostBack="false" TextMode="MultiLine"></asp:TextBox>

 

I hope this is help to you all.

 
Sign Up to vote for this article
 
About Author
 
ashraf
Occupation-Not Provided
Company-Not Provided
Member Type-Fresh
Location-Not Provided
Joined date-01 Aug 2009
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
By:johnDate Of Posted:8/22/2010 5:36:13 PM
Mr
Thanks a lot for this. But I am having issues getting it to work after any post back in an update panel? Any ideas?
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top