Ashwin Singh
Ashwin Singh

Reputation: 1

ASP.NET content display

I am building a profile page in asp.net and it has two tabs(Horizontally), one for profile and one for settings. If a user navigates between tabs, he will see the settings page and the profile page. I know two ways to implement this.

  1. Code the page contents in the page and use javascript to hide them, while navigating through them. This type of method is inefficient as it will lead to performance issues and increase load time.

  2. Use onclick event handler and build the page using codebehind file. This is more efficient way, I can use javascript to rotate something to show that something is being processed and then call a last method in codebehind to hide the rotating Image.

Besides these methods, Are there some other efficient ways to accomplish this?

Upvotes: 0

Views: 69

Answers (1)

Erik Funkenbusch
Erik Funkenbusch

Reputation: 93434

The answer depends on many factors. Do you want the user to be able to switch back and forth without page refreshes? If so, then you have to load both tabs.

If you're ok with partial refreshes, then you can use Ajax to populate the tabs when you click on them. This has some performance consequences, since it needs to round trip to get the data.

If you're ok with complete refreshes, then simply have each be a different page, when you click on the other tab, it just loads the other tab page.

I'm really not sure what you mean by "build the page with code-behind". Perhaps you mean only include the html for the selected tab when the page is loaded. In my opinion, it's easier to simply make them different pages than to write complex code that changes the structure of the page.

Upvotes: 1

Related Questions