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
Code
..............
' />
....................How do I get it done?


Marius VasileRank #785 · 2.9K reputationPosted Nov 18, 2023, 8:24 AM EST
I found a solution by
$(document).ready(function () { var textAreaAdjust = function (control) { $(control).height(1); $(control).height($(control).prop('scrollHeight')); } textAreaAdjust($('#txtDescriere')); };which seems to work
Marius VasileRank #785 · 2.9K reputationPosted Nov 18, 2023, 11:21 AM EST
Well, is not working properly. Yes for the first record it does but for the second it only shows 2 lines :(