views:

423

answers:

1

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..

+1  A: 

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.

Bryan
Thanks, I think it's just weird securit settings in IE when trying to do this via a local file like c:\etc\etc\test.html which has the nested iFrame. If I put that file inside any legitimate website and load via a proper http:// url, it works.Weird.
WesleyJohnson
+1 for the info on ViewState, btw. I also just voted to close the question.
WesleyJohnson