Caching when filling panels with content

I’m creating a group of surveys that query Salesforce (salesforce.com CRM) to generate survey questions dynamically.

The survey layouts are determined by a record type that gets passed in the QueryString. The page queries Salesforce and aggregates the questions/fields it should be using. Then it creates questions and adds them to a panel.

When I open one survey, things look great, and they work as designed. But on opening a separate survey, of a different type, the questions from the first survey are still in the questions panel, as if they are cached somewhere.

To see what I mean, open “Survey 1”. Then open “Survey 2” in a new tab. Now re-open “Survey 1”, but this time do it in a new tab. Compare the first “Survey 1” to the second “Survey 1”, and you’ll see that the second “Survey 1” has the questions from “Survey 2” added into it.

Survey 1: Cancelled Appt: http://www.nationallandpartners.com/survey/?sid=a0RT0000000HPV2&type=012T0000000CwKx
Survey 2: Purchased: http://www.nationallandpartners.com/survey/?sid=a0RT0000000HHLk&type=012T0000000Cvr7
Survey 3: Toured, Didn’t Buy: http://www.nationallandpartners.com/survey/?sid=a0RT0000000HQQk&type=012T0000000CwPi

Is there something - or a way that - I should be clearing variables, public variables, sessions, or page/panel caches on every page load?

I define the array where the fields/questions are aggregated like this:

    public partial class _Default : System.Web.UI.Page
    {
        private static ArrayList field_names_use = new ArrayList { };

How are you handling the caching? Is it pageOutputCaching? If so then you will need to add the VaryByParam parameters. Which in your case would be sid and type.

NightStalker, this is the first I’ve ever ventured into the world of caching. I changed my “private static ArrayList” into an “internal” and this seems to have fixed it.

Is this a smart way to do it, or would you consider it dumb?

static is shared amongst the entire app. So that would be the same. internal is just an access modifier. Static is what you want to remove. Or just the way it loads the data. As static makes the entire app use one ArrayList.