Marius Vasile

Marius Vasile

  • 599
  • 1.7k
  • 126.4k

Automatically increase height of a textbox inside a Datalist

Nov 18 2023 11:52 AM

I sometimes have a large amount of data in a textbox, 20-30 lines, other times only few lines. The textbox is inside a Datalist and I want to make it change its height based on the amount of data it contains. The solutions found were not helping at all

<asp:DataList ID="DataList2" runat="server" Style="width: 100%" OnItemDataBound="DataList2_ItemDataBound">
    <ItemTemplate>
..............
        <div class="row no-gutters">
           <asp:TextBox ID="txtDescriere" class="form-control form-control-sm"
                  Style="font-size: 12px; color: black; resize: none; font-weight: 500;" 
                  runat="server" TextMode="MultiLine" Rows="5"
                   ClientIDMode="Static" Text='<%#Eval("Descriere")%>' />
         </div>

....................

    </ItemTemplate>
</asp:DataList>

How do I get it done?


Answers (2)