Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamically Created User Control's Dropbox Items from Database resets on postback
    text
    copied!<p>First off, I have managed to create a web application where my dynamically created user controls are recreated and repopulated with the correct information upon postback. I am not sure what my problem is, but i hope that you will be able to help me figure it out based on my situation:</p> <p>On my page i enter the number of controls to be created into a hardcoded textbox (its on the aspx page) and click the okay butten. This in turn, creates the specified number of user controls dynamically using c# in the background.</p> <p>So far the desired number of dynamic controls are in a table on the page. Next...</p> <p>I have 1 textbox and 4 dropboxes on each dynamic user control. When i type a company name into the textbox field and press enter or click away (on text changed event) it autoposts back and the textbox retains the company name that i have typed in. </p> <p>Based on this string the dropboxes are populated from the database. Now when i select the desired items from the dropboxes and click on the save button (located outside of the dynamic controls, on the page) it does an insert to the database, but it turns out that upon this postback the indexes from the dropboxes have been reset and the wrong values get inserted.</p> <p>The following pictures show firstly, how it should be and then how it is.</p> <p>Basically the company name remains in the textbox of the dynamic control, but the information i choose from the dropbox resets to the first index.</p> <p><img src="https://i.stack.imgur.com/FtSeP.png" alt="How is should be"></p> <p><img src="https://i.stack.imgur.com/8PTP5.png" alt="How it really is"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload