Hi,

I have written a custom control(ASCX component developed in C# and
.NET) to display flex charts through web-service.

For this, i have embeded a .swf file in the custom control, that
creates charts.

Now I am calling this control in my master page using LoadControl
which finally gets added to a Panel (which is my place holder for the
control).

This control is called in 2 loops which looks like:

<%for (int i = 0; i < mainObject.Length; i++) { %>

-- some code--

 <%for(int i = 0 ; i < ChartType.Length; i++) {%>
     <tr>
        <td colSpan="2" align="center">            
          <asp:Panel ID="ChartPanel" runat="server"></asp:Panel>
           <%calling dynamic control from code behind with    
LoadControl for different chart ids.....%>                           
                                                                     
                                                                     
                          
       </td>
</tr>                                                                
                                                                     
                                                      

  <%} %>

-- some code--

<%} %>


# Code behind

ChartContainerControl customChartControl = (ChartContainerControl)
LoadControl("ChartContainerControl.ascx") as ChartContainerControl;

customChartControl.ID = objectId + "_" + objectType.ToString() + "_" +
chartType.ToString();

customChartControl.chartDivId = objectId + "_" + objectType.ToString()
+ "_" + chartType.ToString() + "_Div";

customChartControl.chartObjId = objectId + "_" + objectType.ToString()
+ "_" + chartType.ToString() + "_Swf";

ChartPanel.Controls.Add(customChartControl); //ChartPanel is what I
want to be dynamic

# End of code behind

This works only for the last iteration of the 1st loop. i.e It
generates chart only for the last iteration.

The problem I found was with Panel id, which was same for all the
iteration and because of that all the chart control were added to one
instance of the Panel Id.

It was impossible for me to generate different panel ids and access it
from code behind.

How do I generate the Panel ids' dynamically and access it in code behind?

So that I can add the chart controls to the specific Panel id.

Or is there any other way to attack this problem?

Thanks in advance.

Zeb


Reply via email to