R – DropdownList losing items on postback in iframe

asp.netiframepostbackviewstate

Having a very strange issue regarding postback in ASP.NET. I have page dynamically populating DropdownLists on Page_Load, only if it's not a postback. I also have several textboxes on the page for user input.

If I postback, either by clicking a submit button or via a SelectedIndexChanged event, the textboxes maintain their values, but the DropdownLists lose all their items – but only IF the page is loaded via an iFrame. If I load the page directly, everything works fine. If I load it via an iFrame, everything but the dropdowns works.

Has anyone run into this behavior before? I don't think it matters, but I'm on Windows7, IIS7, ASP.NET 3.5 and browing with IE8. ViewState is enabled, which is apparent from the textboxes having their values persisted. The ASP.NET page is in a WebApp hosted on localhost. The containing page, with the IFrame tag is just a dummy HTML file sitting on my desktop for testing. Is this perhaps just an IE security issue?

UPDATE:
I actually just moved the "dummy" container page into the Webapp and it seems to work fine, even via the iFrame. Still, I'd like to know why this is happening if the containing page is outside the Webapp as I intend on having people load the page in and iFrame via other domains..

Best Answer

This is probably a ViewState issue. The values in the TextBox controls come from the post data, not the ViewState, so it is no indication that it is working correctly.