SharePoint Create a tabbed view in c#

There are a lot of samples how to create tabbed view for list forms or webparts in SharePoint. Mostly they are build up with javascript, ajax or jquery. Well these technologies are really interesting, but today i am gonna make a short example of creating such tabbed views in c# using asp.net.

The advantages are crystal clear: If you have a form with lots of fields you can group them into tabs and the user

  • see the section important fields
  • does not need to scroll really deep
  • have all fields in the scope of his or her eyes

Ok, let’s start with a simple application page which we add to our project solution. I recently builded the demo based on this post.

In this application page we insert in the aspx file the following code into the placeholder main:

[sourcecode language=”csharp”]







[/sourcecode]

Here we define the menu which appears as tabs. You can choose your own image and your style as well as your text.

[sourcecode language=”csharp”]





TAB VIEW 1 INSERT YOUR CONENT IN HERE CHANGE SELECTED IMAGE URL AS NECESSARY


TAB VIEW 2 INSERT YOUR CONENT IN HERE CHANGE SELECTED IMAGE URL AS NECESSARY


TAB VIEW 3 INSERT YOUR CONENT IN HERE CHANGE SELECTED IMAGE URL AS NECESSARY

[/sourcecode]

In this multiview you can add your content which should appear in the tabs.

[sourcecode language=”csharp”]

protected void Menu1_MenuItemClick(object sender, MenuEventArgs e)
{

MultiView1.ActiveViewIndex = Int32.Parse(Menu1.SelectedValue);

}

[/sourcecode]

This code snippet acts if you click on one of the tabs. In order to change the tab view.

The result should look like this:

Tabbed

Hope this helps. It won’t win a price for being pretty, but it just shows set it up. The styling and the content is up to you now.

..:: I LIKE SHAREPOINT ::..

The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

About Karsten Schneider 312 Articles
Consultant for Microsoft 365 Applications with a strong focus in Teams, SharePoint Online, OneDrive for Business as well as PowerPlatform with PowerApps, Flow and PowerBI. I provide Workshops for Governance & Security in Office 365 and Development of Solutions in the area of Collaboration and Teamwork based on Microsoft 365 and Azure Cloud Solutions. In his free time he tries to collect tipps and worthy experience in this blog.

Be the first to comment

Leave a Reply

Your email address will not be published.


*