Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed Help with Page Life Cycle(I think it is screwing me up)
    text
    copied!<p>I have dragged a empty asp.net table onto my webform. I generate all the rows in the code behind those. </p> <p>Now my table gets filled up and has dropdown lists. When the user hits save I go through all the rows and update the values from the dropdownlist in the db.</p> <p>This works all great. However if 2 columns have each have "Present" then those 2 columns should be not be shown anymore and 2 new columns get put in its place with other dropdown lists.</p> <p>This all works. However you have to refresh the entire page to for the 2 columns that should go away to go away. </p> <p>So what I tried to do is at the end of the button click event. Clear the whole table and then regenerate it. However when I do this then my values are not saved to the database anymore for whatever reason.</p> <pre><code>if (IsPostBack == false) { // check if dummy variables exist in db- If true just generate tables with values in db. If not generate them. } else { // grab the values from the database // generate tables with the values } btn click event { go through all rows in table(foreach loop) update each column in the database with cells in each row. while in foreach loop. //done } </code></pre> <p>So this is how it goes and it works expect(all correct values are saved) the table is just not updated to the user.</p> <p>Does not work</p> <pre><code> if (IsPostBack == false) { // same code as above } // if postback is true do nothing. By the time it gets to the click event it says there is zero rows in the table so nothing happens. btn click event { // same code } </code></pre> <p>Fails also.</p> <pre><code>if (IsPostBack == false) { // same code as above } else { // same code as above but moved into its own method. gernerateTable(); } btn click event { // update all rows // once done clear the Tables rows // call generateTable() } </code></pre> <p>This last one does nothing as for some reason it does not update anything. I don't understand why.</p> <p>So what am I doing wrong with this life cycle something in my process is wrong. The code works just not when I want the table to be updated right away.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload