1

I have multiple iframe in my asp.net page. But all this iframe are loading through loop and having same page in all. These all iframes are loading at last, after loop completes and because of these i am getting last loop data in all iframes.

What to do for this.

This is my main page code where Iframe created in loop:

 for (int iCount = 0; iCount < rcChartSubject.Items.Count; iCount++)
    {
SetChart();
    if (iCount.Equals(1))
                {
                    divRadarChart1.InnerHtml = "";
                    divRadarChart1.InnerHtml = "<iframe class='RadarSize' src='RadarChart.aspx' frameborder='0' width='680px' height='480px'></iframe>";
                    divRadar1.Visible = true;
                }
                else if (iCount.Equals(2))
                {
                    divRadarChart2.InnerHtml = "";
                    divRadarChart2.InnerHtml = "<iframe class='RadarSize' src='RadarChart.aspx' frameborder='0' width='680px' height='480px'></iframe>";
                    divRadar2.Visible = true;
                }
    }

In SetChart() method i am setting global variable for generating chart. But if for loop is for 4 times then iframe page is loading at last 4 times instead of loading in for loop one by one and due to this i am getting last for loop global variables.

And On RadarChart.aspx page I am using those global variables value like below :

protected void Page_Load(object sender, EventArgs e)
    {
 ltRadar.Text += string.Format("<input type='hidden' name='chxl' value='0:|{0}|1:|{1} |' />", strRadarChartSubjectLabel, strRadarChartAxisValue);
}
5
  • can you please put more details. not clear. Commented Sep 26, 2011 at 10:00
  • I don't understand. Please provide an example of this "last loop data" problem. Commented Sep 26, 2011 at 10:01
  • Could show us some code perhaps? Commented Sep 26, 2011 at 10:01
  • I am loading iframe in for loop in div as: divRadarChart1.InnerHtml = "<iframe class='RadarSize' src='RadarChart.aspx' frameborder='0' width='680px' height='480px'></iframe>"; In for loop i am setting variables for loading page. But all these iframes are loading after for loop completes and because of this i am getting last for loop variable in all charts. Commented Sep 26, 2011 at 10:10
  • Put your code in your question so we can check your loop logic. Commented Sep 26, 2011 at 10:40

1 Answer 1

3

All Iframe will loads pages at last when your loop completes its execution. So at that time you will have last data in all your variables if you are using global variables and set those variable's value in your iframe page. Better you try with query string where you can pass your all variable's values and set those values in page. So all pages will have seperate data to load.

Try this :

<iframe class='RadarSize' src='RadarChart.aspx?q1=val1&q2=val2' frameborder='0' width='680px' height='480px'></iframe>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.