I built a CompositeControl in ASP.Net and now I'm having trouble maintaining the ViewState of 3 instances of the Control on the hosting page. My CompositeControl has a property "HeaderText" and all 3 instances of my CompositeControl do have the value of the first control instance on the page.
For example: If the first control has HeaderText = "Test 1", then all other controls have also HeaderText = "Test 1".
During debugging I found out that the set operator of the property is called 2 times. When I trace the set operator with Debug.WriteLine() outputs then the output looks like:
HeaderText of Control 1 = "Test 1"
HeaderText of Control 2 = "Test 2"
HeaderText of Control 3 = "Test 3"
HeaderText of Control 1 = "Test 1" <-- Why is the set operator called 2 times for each Control?
HeaderText of Control 2 = "Test 1"
HeaderText of Control 3 = "Test 1"