C
Craig
Hi
I've been struggling with this problem for several days now, pretty much out
of ideas...
I have n number of xml files each defines what server side control to to
render inside my custom web control (composite). The OnInit of my web
control parses the xml files creating a collection of internal object
structures, like:
Report
ParmsCollection Parms get {...}
Parm
Control get {...}
In the OnInit, I assign the collection to the Session
Now for CreateChildControls, it looks something like this:
protected override void CreateChildControls() {
Controls.Clear();
DropDownList ddlReport = new DropDownList();
ddlReport.AutoPostback = true;
Controls.Add(ddlReport);
ArrayList reports = (ArrayList)Session["Reports"];
foreach(Report report in reports) {
ddlReport.Items.Add(report.Name);
}
Report report = reports[0];
// Now add the report controls
foreach(Parm parm in report.Parms) {
Controls.Add(parm.Control);
}
}
So the ddlReport drop down renders with the control(s) from the report
parameters. Now I select a different report from the drop down; this is
where everything goes to hell... I don't get the event from the ddlReport
control, when I hack something together making the selected report render it
controls, I end up with the Failed to load ViewState, needs to be re-created
the same way it was rendered.
Can anyonw help m out, this is frustrating me to bits.
I've been struggling with this problem for several days now, pretty much out
of ideas...
I have n number of xml files each defines what server side control to to
render inside my custom web control (composite). The OnInit of my web
control parses the xml files creating a collection of internal object
structures, like:
Report
ParmsCollection Parms get {...}
Parm
Control get {...}
In the OnInit, I assign the collection to the Session
Now for CreateChildControls, it looks something like this:
protected override void CreateChildControls() {
Controls.Clear();
DropDownList ddlReport = new DropDownList();
ddlReport.AutoPostback = true;
Controls.Add(ddlReport);
ArrayList reports = (ArrayList)Session["Reports"];
foreach(Report report in reports) {
ddlReport.Items.Add(report.Name);
}
Report report = reports[0];
// Now add the report controls
foreach(Parm parm in report.Parms) {
Controls.Add(parm.Control);
}
}
So the ddlReport drop down renders with the control(s) from the report
parameters. Now I select a different report from the drop down; this is
where everything goes to hell... I don't get the event from the ddlReport
control, when I hack something together making the selected report render it
controls, I end up with the Failed to load ViewState, needs to be re-created
the same way it was rendered.
Can anyonw help m out, this is frustrating me to bits.