views:

25

answers:

2

I have a very simple user control with 5 radio buttons on it, and 3 properties (ID, RatingSetID, and Rating). On the initial load of the page they are on, the code acquires data and places the data into the 3 properties. However, when the submit button is clicked the page reloads and the 3 properties get reset to 0, they are in the !IsPostBack as well. I know I am missing something simple.

Can anyone help?

A: 

The usercontrol might be reloaded when postback if you load this control on the fly

Arief Iman Santoso
The control is placed on the form at design time. I am however, adding attributes in the Page_Init, could htis be the issue?
mattgcon
your controls properties don't get into ViewState I suppose. Could you post your code where you define the usercontrols properties?
Arief Iman Santoso
Please take a look also at this question http://stackoverflow.com/questions/2538600/usercontrol-losing-viewstate-across-postback
Arief Iman Santoso
Thank Arief, the link you gave me allowed me to correct this issue by issue ViewState to the control
mattgcon
A: 

The user control get reload when the postback happens. You can place it into an UpdatePanel it could solve your problem.

CoffeeCode
Even though the control gets reloaded, shouldnt the properties stay? How do I simply retain the property values, I dont want to use an UpdatePanel
mattgcon