title: ASP.NET C# Dynamically create table with postback button on each row
body: <p>I am trying to display a table dynamically loaded from database with dynamically created button in the first cell of each row. Each button has assigned ROW_ID value that uniquely identifies the button in one "generic" method handler.</p>
  
  <p>As far as I can understand the only way I can do this is by loading data and displaying it &amp; wiring-up buttons to handler during Init life-cycle phase. The problem I am facing is when this button would (for example purposes) were to call delete (or other modification) procedure in the database for that particular row I would have to do Response.End and reload the page to reflect this modification, because during PostBack handlers its already too late to re-fetch new dataset from DB and create new set of buttons and wire it to the handler. Full page reload however losses state for all controls, which is not desirable.</p>
  
  <p>One thing to note: I am using custom-render user control to display the resultset from database (it looks like a table though). I am not using DataGridView with DataBinding.</p>
  
  <p>Possible solution would be to use radio-button for each row and one static button in the bottom, but this is far from ideal.</p>
  
  <p>The questions is: Whats better way to do this? Am I missing something? I find it hard to believe that ASP.NET would be this cumbersome to handle this generic use case.</p>
  
  <p>Thanks for any possible suggestions.</p>