I've got an issue with nested controls not loading properly. I've tried various page methods and nothing seems to work.
EDIT: The site compiles and runs fine--it just leaves a blank screen though.
Basically I have a wrapper control for a Chart that allows me to select data, bind, and customize the chart with a lot of abstraction. I need another wrapper control for that because there may be groups of charts that I want to represent easily.
Generalized answers would be great too.
Here's what I have. I've replaced my custom properties/attributes with fillers:
Default.aspx:
<%@ Page Language="C#" CodeBehind="Default.aspx.cs" %>
<%@ Register src="OuterUserControl.ascx" tagname="OuterUserControl" tagprefix="uc2" %>
<uc2:OuterUserControl ID="uc1" runat="server" Att1="foo" Att2="bar" />
OuterUserControl.ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OuterUserControl.ascx.cs" Inherits="Proj.OuterUserControl" EnableViewState="false" %>
<%@ Register src="InnerUserControl.ascx" tagname="InnerUserControl" tagprefix="uc1" %>
<div runat="server" id="holder"></div>
OuterUserControl.ascx.cs:
private member variables
Att1
Att2
protected void Page_Load(object sender, EventArgs e)
{
for(int i=0;i<5;i++)
{
InnerUserControl cuc = new InnerUserControl(id);
holder.Controls.Add(cuc);
}
}
InnerUserControl.ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="InnerUserControl.ascx.cs" Inherits="Proj.InnerUserControl" %>
<asp:Chart ID="chart" runat="server"></asp:Chart>
InnerUserControl.ascx.cs:
private int id;
//private member variables
public InnerUserControl(int id)
{
this.id = id;
this.chart = new Chart();
}
protected void Page_Load(object sender, EventArgs e)
{
//Get data for given id
//Databind chart
//etc..
}