0

Is there a way to resize the GridView height every time an item is added or deleted? Let's say I have an initial height, and every time I add an item, I want to resize the gridview +20px or -20px if I delete an item.

Or even better, maybe an autoresize is available?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Popplar
  • 279
  • 5
  • 15
  • I think you added a Height attribute to the gridview so now its not autoresizing. Remove Height atrribute so it will autoresize – H.Mikhaeljan Apr 20 '18 at 14:21
  • Yes, its inside a div which has got a height, the problem is that if I don't set a heigth to that div, then the gridview is not seen totally. https://puu.sh/A74lw/1c308c06c3.png – Popplar Apr 20 '18 at 14:46
  • so the issue is the div and not the gridview. What purpose does the div have and what css classes/styling – H.Mikhaeljan Apr 20 '18 at 14:58
  • The purpose of the div is to set a Width, for some reason when setting a Width to the gridview, if I have a lot of columns, it exceed the width I had set. – Popplar Apr 20 '18 at 15:00
  • if I dont use the div, the gridview width gets bigger than the one I set. Example, I set the gridview width to 300px and if I add various columns the width size increase. – Popplar Apr 23 '18 at 11:03
  • multiple answers [here](https://stackoverflow.com/questions/8265964/asp-net-set-gridview-column-max-width-size) – H.Mikhaeljan Apr 23 '18 at 11:09
  • Thanks a lot, this is what helped me: style="overflow-x: auto;" and now the gridview mantains the correct size when adding or deleting items from it. – Popplar Apr 25 '18 at 03:17

0 Answers0