asp.net adding row to a table in update panel


I'm trying to add some rows to a table control in my updatepanel. I have a button in update panel and when the button is clicked, partial postback happens, in button_click handler I add 1 row to the table. I can trigger the postback event and I am able to add 1 row each time, but the problem is that every time the page is postedback I got the initial table, meaning all the rows I've added in previous postbacks are gone, how can I solve this? Any ideas are welcome?


When you add rows in the table, you also need to save the struck of the table and somewhere else, for example on the view state, or on a database, or somewhere, and then recreate it because the code behind and the page it self did not have "a memory for what you do" on a table, did not know what you do on the DOM in general.

You may see the table on the page, but when you make a post back, the code behind did not get the post back of the struck of the table, only the posted data from input controls, so did not know by default what you have done on the table, and renders it from the beginning.

So, if you won to add rows in a table, and you won to remembers them on the next post back, save your struct also somewhere else, and when I say your struct, I do not mean all the table, you can simple save a number, eg how many rows you have add, or a number and an id, how many rows and what is on every row, and then before you add new rows, and on every post back, you recreate the table.


  • low level information needed for the uploading of the files via http and html [closed]
  • Persist c# objects across postbacks
  • Pandas DataFrame column values in to list
  • 2-table interaction: insert, get result, insert
  • Single django queryset to get n adjacent items
  • Retaining data after updating application
  • Is there a way to dynamically embed PDF Files in a JSP pulled from the file system?
  • How to add a focus style to an editable ComboBox in WPF
  • Java color detection
  • How to define custom class, title, and target in Link Browser for content elements and the new rte_c
  • d3 v4 drag and drop with TypeScript
  • Ionic 2 storage is not cleaning up on uninstall - Only for signed APK
  • How to define and use opencv mat of user type
  • preg_replace Double Spaces to tab (\\t) at the beginning of a line
  • JQuery Internet Explorer and ajaxstop
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Cassandra Data Model
  • Join two tables and save into third-sql
  • htaccess rewriting URLs with multiple forward slashes
  • How to model a transition system with SPIN
  • Updated Ionic CLI but shows previous version (Windows)
  • Display Images one by one with next and previous functionality
  • ORA-29908: missing primary invocation for ancillary operator
  • Web-crawler for facebook in python
  • Unanticipated behavior
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • A cron job substitute?
  • WPF Applying a trigger on binding failure
  • Getting Messege Twice Using IMvxMessenger
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Linking SubReports Without LinkChild/LinkMaster
  • How can I remove ASP.NET Designer.cs files?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • Can't mass-assign protected attributes when import data from csv file
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Unable to use reactive element in my shiny app
  • Converting MP3 duration time
  • Conditional In-Line CSS for IE and Others?
  • Python/Django TangoWithDjango Models and Databases