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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:55:16+00:00 2026-05-28T01:55:16+00:00

Alright so in the project I am working on I am making a hard

  • 0

Alright so in the project I am working on I am making a hard coded asp:panel on the page and then filling it with:

  1. A Drop Down list
  2. An asp:Table, with an asp:TableHeaderRow
  3. Add and Cancel Buttons

When the selectedIndexChanged event happens with the DropDownList the tablerow gets created then filled with 6 or so tablecells which then get asp:Textboxes placed inside of them.

Eventually they all get added to the tablerow which then gets added to the tablerowcollection.

That all works just fine,but when I go to add the information from these dynamically created TableRows with a foreach loop they are no where to be found but the TableHeaderRow is.

Also when I click add and let it go through the process I get no null exceptions and the only thing left after it is the header, all my rows disappear.

Anyways I feel that I am just missing something really dumb. I’ve looked through a lot of forums, posts, MSDN and never found an answer to my problem. Any help would greatly be appreciated!

  • 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-28T01:55:17+00:00Added an answer on May 28, 2026 at 1:55 am

    You need to add your dynamic rows to your Table in Page_Init not Page_Load. If you are creating it in Page_Load your new rows won’t be added to ViewState and you will see this problem.

    Unfortunately you are adding them in response to a server side event which can get tricky. You still need to add the rows in Page_Init but when the page posts back and you at in Page_Init then the selectedIndexChanged event hasn’t yet fired. It’s too early in the page lifecycle.

    If you want to know if it has fired at Page_Init the only way I have found is by examining Request.Form("__EVENTTARGET") collection at that point. This contains the control ID of the control that has triggered the postback – in your case this will be the dropdown list. The control that fired the event will be there but the ID will be qualified i.e not MyControID but ctl_MasterPageContentHolderID_NamingContainer1_MyControlID` or the like – so you will have to take it into account when looking for it. Once you have identified that that event has fired then you can add the rows. Once they are added there then they won’t disappear.

    As I say it is tricky to get working but I have done this successfully in the past. Generally dynamic controls can be very hard to work with for just this reason. You may want to consider alternatives. Best of luck with it anyway though.

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

Sidebar

Related Questions

Alright, I need a sanity check. I was working on my project by starting
Alright so I'm working on a project where I want the app to check
Alright, still working on a science project involving the testing of the speeds of
In my working folder of a VSS project, is it alright if I make
Alright, for a project, there's an XML page, which uses the user's cookies to
Alright, im working on a project in Python, which is my first REAL Python
I had a great working PhoneGap mobile web-app project, then my laptop died. I
Alright I created some custom classes for my project sourced from this tutorial ,
Alright, I am still messing around with Core Data in my iOS project, and
Alright I don't see why this isnt working. It seems pretty simple. Here is

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.