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 849861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:10:10+00:00 2026-05-15T07:10:10+00:00

I am dynamically creating a table that contains a textbox in each cell. The

  • 0

I am dynamically creating a table that contains a textbox in each cell. The table is put in a placeholder control. Everything displays perfectly. The problem is when I go to retrieve the values entered in the cells. I have the code to generate the table in a separate method called CreateTable(). In order for my program to find a table in the placeholder when I go to save, I have to run CreateTable() in a postback event AND in the PageLoad event. If I call CreateTable() in only one of those places and I try to save, it says the placeholder is empty and, therefore, I cannot save the textbox contents. I’ve tried calling CreateTable() from InitLoad but that doesn’t work because it needs to reference values from three static controls: 1 dropdown, 1 listbox, and 1 calendar control, which I don’t believe have had their viewstate rendered yet. Anyone have any ideas? It would sure be nice not to have to double the number of database calls just to make this work.

  • 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-15T07:10:10+00:00Added an answer on May 15, 2026 at 7:10 am

    Welcome to the wonderful world of ViewState and dynamic controls 🙂

    If you use both (ViewState and dynamic controls) you have to recreate your controls in every request because they are needed to recreate the ViewState. Split your code in control creation code (CreateTable?) and code to fill the controls (FillTable?). The best place for the control creation code is the PageInit event. This is the part of code that has to run in every request. Place the other code wherever you need it (Postback?, LoadEvent?). This part of code has to run once. After this it is part of the ViewState.

    If the control creation part of your code depends on the ViewState (values of your static controls) you are in bigger trouble. You can’t access the ViewState in PageInit! Use another storage methode (SessionState?) to persist this information and redirect to your own page.

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

Sidebar

Related Questions

I am dynamically creating a table which places a dynamically created radiobuttonlist in each
I have a page that is creating dynamically created rows in a table with
I'm dynamically creating table rows. So each time I add a row, I need
I am dynamically creating a table in C# with ASP.NET, and each row will
I am creating a table (stats_1) dynamically and would like to have each row
I am having a JSP page, where i am dynamically creating a Table data.
hi all i am declaring id and class when creating table dynamically as below
I'm creating a table in an asp.net code behind dynamically, and I want to
I'm having a table in which i'm creating a label dynamically. '<td>' + '<label
I recently found that dynamically creating object and methods in Ruby is quite a

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.