2
votes

I'm writing a survey web application and I have a wizard control with a few steps added from the designer view. The user selects the name of the survey they would like to complete in the first step, then the user hits the next button and I read the survey details from the database. I have created custom user controls for each type of question which I programatically add to step 2 of the wizard control after reading each survey question from the database.

This works fine, and the survey displays as expected. However, when the user fills in the answers to the questions and hits next, I don't have access to the answers typed into the text boxes. It seems as though all the custom controls I have added to step 2 have been deleted since I get a null reference exception when trying to access the controls. I even printed out the number of controls in step 2 after the next button was hit (it should be 11) but instead printed out that there were no controls in the step.

Am I missing something? Is there a property I need to set to be able to access my dynamically added controls from a step?

1

1 Answers

0
votes

You are saying that null reference exception is comming.

Try to find if you are using drop down control in your application.

If it is present, then this exception comes when there is no selected value in drop down and you try to insert it in database.

also check your code if you are writing it as, ddlOptions.SelectedItem.toString();

If so, then edit it to>> ddlOptions.text