Redirecting with Frames in ASP.NET Web Forms

In one of the applications that I work on, we have a frameset layout consisting one one horizontally narrow frame at the top of the page (composed of the header/menu), and one main frame in the remaining lower part of the page (composed of the rest of the content).

Ignoring the fact that I’m well aware that using frames is not a good approach in this day and age, there are some things that take time to move away from in an established application such as the one I work on.

In the mean time, I have been working on a “welcome screen” of sorts, where the user is given some stats about their account and those stats are occasionally linked to redirect them to the appropriate part of the application if they wanted to look more into the numbers.

I came across a problem when I attempted to redirect the user. In the header frame, we have a drop-down list made up of different sections of the application that users can navigate to. When the user clicks on a link from the welcome screen, they should be taken to the appropriate related screen in a different section. Thus, we would expect that the drop-down list in the header would automatically update to reflect the change.

This did not work in Chrome. However, it worked fine in Firefox and Internet Explorer. Yet another “feature” of Chrome. Go figure.

Get to the point

Yes, right. So in ASP.NET there are two controls for links. Either you use a LinkButton (with a PostBackURL attribute) or a Hyperlink (with a NavigateURL attribute), depending on if you need an event or not. I used one of those controls with the attribute instead of an event to avoid unnecessary calls to the server-side, but alas, that was the cause of the problem.

I had to switch the Hyperlinks to LinkButton, and then create an event that fires on click to do a Response.Redirect instead. This worked handsomely on all of the major browsers, and the drop-down list now updates appropriately.

I didn’t look more into it so I’m not quite sure about the technical details about why Chrome was not behaving like the other browsers, but nonetheless, I hope this tidbit of advice helps someone out there.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s