I have a reporting module (C# asp.net) that uses dynamic controls to represent the varying parameters of the selected reports.
The dynamic controls build and display fine (XML stored in SQL Server 2008 and XSLT for the transform into HTML).
My problem is that I have a drop down list(not dynamically created) that contains the report names as text and the report id's as the value. This DDL posts back when its selected index changes. When the DDL posts back, a session and viewstate variable containing the selected report id is populated. I want to read this variable and use it to generate the dynamic parameter controls. This is what happens:
1.Reports DDL initial value (text="--Reports--",value="-1")
2.The user selects a report from the DDL.
3.Reports DDL user selected value (text="Report1", value = "1").
4.DDL posts back and the dynamic parameter controls are generated.
5.The report value of 1 is placed in a session/viewstate variable via the selectedindexchanged event of the DDL.
The problem is in step 4 the dynamic parameter controls are being generated with a report value of -1 because the controls are generated before the selectedindexchanged event fires and therefore the dynamic controls are a step ahead of the DDL.
All of these controls are in an AJAX updatepanel (all controls in the same panel).
What is the best way around this?
Thanks,
Rich.