Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 703253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:48:39+00:00 2026-05-14T03:48:39+00:00

I have dragged a empty asp.net table onto my webform. I generate all the

  • 0

I have dragged a empty asp.net table onto my webform. I generate all the rows in the code behind those.

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.

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.

This all works. However you have to refresh the entire page to for the 2 columns that should go away to go away.

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.

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
}

So this is how it goes and it works expect(all correct values are saved) the table is just not updated to the user.

Does not work

    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
    }

Fails also.

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()
}

This last one does nothing as for some reason it does not update anything. I don’t understand why.

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:48:39+00:00Added an answer on May 14, 2026 at 3:48 am

    In building a page, ASP.NET generates control ID’s as the controls are created. These ID’s are rendered to the HTML and submitted by the browser back to the server. During postback, ASP.NET re-generates the controls on the page to determine ID’s, then assigns data values to the controls from the Request data.

    So, if you dynamically generate controls (table rows with drop-down lists) then you need to generate all those rows before you inspect, save, or modify them. A common pattern that I have used in the past is something like this:

    OnPageLoad() {
      get data;
      build controls;
      bind data; 
    }
    
    OnButtonClick() {
      save data();
      build controls; // if changed by 'remove' or 'add'
      bind data;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you guys had any experiences (positive or negative) by placing your source code/solution
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you determined a maximum number of characters allowed in FCKEditor ? I seem
Have a n-tire web application and search often times out after 30 secs. How
Have you managed to get Aptana Studio debugging to work? I tried following this,
Have had to write my first proper multithreaded coded recently, and realised just how
Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.