---
title: "Auto height in multiline textbox"  
description: "Auto height in multiline textbox"  
author: "Anonymous User"  
published: 2013-09-03  
updated: 2013-09-03  
canonical: https://www.mindstick.com/forum/1426/auto-height-in-multiline-textbox  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Auto height in multiline textbox

I have to show [data from database](https://www.mindstick.com/forum/34370/how-to-populate-google-charts-using-data-from-database-created-via-data-first-asp-dot-net-mvc) with multiline [textbox](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview).

How can i set height [auto](https://www.mindstick.com/forum/33810/remote-view-in-android-auto-cancel-custom-notification) in this multiline textbox?

My [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) is here,

<asp:TextBox ID="txtNaiyo" runat="[server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over)" TextMode="MultiLine" Rows="5" Width="100%" [style](https://www.mindstick.com/articles/126300/apa-citation-style-get-to-know-about-it-for-your-next-assignment)="height:auto;" [Value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages)='<%# [Eval](https://www.mindstick.com/forum/2167/inline-coding-one-more-eval-merge)("Naiyo") %>'/>

Thanks in advance.

## Replies

### Reply by Sumit Kesarwani

Hi Pravesh,\

I've made something quite easy. First I put the TextArea into a DIV. Second, I've called on Ready Function to this script

```
<div id="divTable">  <textarea ID="txt" Rows="1" TextMode="MultiLine" /></div>$(document).ready(function () {  var heightTextArea = $('#txt').height();  var divTable = document.getElementById('divTable');  $('#txt').attr('rows', parseInt(parseInt(divTable .style.height) / parseInt(altoFila)));});
```

Simple. Is the Max Height of the div once is render, divided the height of one TextArea of one row.

\

Hope this will solve your problem.


---

Original Source: https://www.mindstick.com/forum/1426/auto-height-in-multiline-textbox

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
