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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:41:16+00:00 2026-06-04T03:41:16+00:00

I have a page in which controls are dynamically generated as the user navigates

  • 0

I have a page in which controls are dynamically generated as the user navigates through a series of questions.

When they finish the form, they click a submit button, and I gather the information they entered and store it in a database.

Currently, I’m creating several of these controls with

.AutoPostBack = True

As a result, every time the user changes the text and tabs to the next field, a postback occurs, and the next field loses focus.

If I set

.AutoPostBack = False

then the focus problem goes away, but at the end when I gather the data, none of what the user entered in those controls is actually available to client side code, because it hasn’t been posted yet.

I’d like to do one of the following:

  1. Have one big postback at the end
  2. Have standard postbacks without losing focus on controls as I leave them
  3. Something else I haven’t thought of…?

Any suggestions?

  • 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-04T03:41:17+00:00Added an answer on June 4, 2026 at 3:41 am

    The key to dynamically created controls is when in the page lifecyle to add the controls. To retain viewstate and have the dynamic controls maintain the posted values, the controls need to be added no later than OnInit().

    In addition, the controls need to be re-added on every page load, postback or not. Regarding what @KennyZ said about guaranteeing the same ID for each control, as long as you are adding the same number of controls in the same order, .NET will guarantee the IDs are the same.

    In regards to the AutoPostBack property, this is usually only set to True when we want to perform some action that is triggered by the user changing the value of the control. A common example is a drop-down list; depending on what the user selected, different data is loaded into, say, the details section of the page. So each time the user changes the value, we want to postback and fetch new data to display.

    From my understanding of your use case, I would suggest one postback for the entire form.

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

Sidebar

Related Questions

I have made a form which adds controls dynamically with user selecting the type
I have a page on which I must load controls dynamically based on the
I have a page in which I am loading a user control dynamically as
I have a page with user controls getting dynamically added. Inside some of these
I have a form with a panel on which I dynamically load multiple user
I have one aspx page with some controls. Also i have one DIV which
I have a nested user control which appears on every single page. It contains
I have some link elements which are dynamically added and hidden from the page.
I have the following dynamically generated table on a page along with other tables
I have a dynamically generated Dropdown for which I need to change the selected

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.