UserControl Postback Issue

rcombs4

Well-known member
Joined
Aug 6, 2008
Messages
189
Programming Experience
3-5
I'm having an issue with a UserControl that I have never really had an issue with before.

The form is a survey that the user fills out. All the questions and response types(textbox, dropdown...) are bound to the DB.

So on the .aspx page i have a user control(CompleteSurvey). Here i pass the SurveyID in the .aspx page, not through code.

On the CompleteSurvey UC I bind a DataList to the DB in the Page_Load Event. Each item in the DataList has another UserControl(SurveyQuestion), which i pass all the needed information(QuestionID, QuestionText, and ResponseType).

on the SurveyQuestion UC i read in the public properties and display the correct information.

Now i have a button on the .aspx page that will get the answers. On the CompelteSurvey UC I have a GetAnswers function. this will run through each row in the datalist and return a class that has the QuestionID and answer.


I can get the form to display properly. I just can't get the GetAnswers funciton to work.

When I let the page_Load go through for each UC i get a list, of correct size, each item has the correct QuestionID but it has "" as the answer.
When i dont let the page_load go through for either i get a list, of correct size, but each item doesnt have either the right questionid or answer.
if i let the page_load go through for just the CompleteSurvey UC i get a list, of correct size, with the correct questionID but "" as the answer. With this case the form no loger is correct. it doesnt show any quesiton or any answer controls.
 
Back
Top