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

  • Home
  • SEARCH
  • 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 8963255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:19:10+00:00 2026-06-15T16:19:10+00:00

I create some tables dynamically in C#, and they are giving me viewstate issues.

  • 0

I create some tables dynamically in C#, and they are giving me viewstate issues. I have a checkbox table and a number entry table that depends on the first. When I press a button that causes postback, I get some problems. Here is a flow chart.

Page_Load

  • create checkbox table
  • create number entry table (check box is always empty, table has wrong number of rows, but numbers are populated correctly from postback)

Postback button

  • create number entry table (check box is now populated, table has correct number of rows, but numbers did not survive postback).

Is there a way I can load the viewstate to the checkbox table before I create the number entry table? I have tried to create the number entry tables in one or the other place (on page load or postback button method), but neither is completely correct. I know that dynamic content needs to be created on every load for the viewstate to appear.

I suspect I may need to create a datatable and store that in the viewstate for the checkboxes to reappear correctly…

  • 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-06-15T16:19:11+00:00Added an answer on June 15, 2026 at 4:19 pm

    I would add your dynamic controls in the PreInit or Init event of your page. Although you can add them afterwards, after the Init phase is when ViewState data is loaded for controls.

    If you add your controls during the Page_Load the control has to play catch up, which means it runs through all of the events in the page lifecycle until it catches up with the rest of the page. This might be causing the issue you’re seeing.

    Here’s an excellent write-up regarding the Page Lifecycle and ViewState:
    http://www.codeproject.com/Articles/24611/ASP-NET-Internals-Viewstate-and-Page-Life-Cycle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a button that will create a new entry (row in a table)
I have a table that i wanted to create some charts. Basically i need
I have a situation where I have to create tables dynamically. Depending on some
Create two tables with some ids overlapping. create table outer_table ( id integer, overlap_in
I have defined a table type PL/SQL variable and added some data there. create
I'm having some weird issues with dynamically populating a table in Javascript. Behold the
I'm using JavaScript to dynamically add rows to a table, I create some textboxes
I'm trying to create some means of dynamically selecting the table for a procedure
I want to create some table through PHP but it fails everytime, but the
I have a string like following: CREATE GLOBAL TEMPORARY TABLE some_temp_table_name or CREATE GLOBAL

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.