nyk0r

Tabbed Control

Dec 22nd, 2011
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASP 3.80 KB | None | 0 0
  1. // Tabbed.ascx
  2. <%@ Control Language="C#" AutoEventWireup="true" CodeFile="Tabbed.ascx.cs" Inherits="TabbedEmployeesFilter" %>
  3.  
  4. <script type="text/javascript">
  5. $(function() {
  6.     var selectTabId = '#<%# selectdTab.Value %>';
  7.     var tabbedWindows = $('div#tabs > .tabbedWindow');
  8.     tabbedWindows.hide().filter(selectTabId).show();
  9.     $('div#tabs ul.tabNavigation a').click(function() {
  10.         tabbedWindows.hide();
  11.         tabbedWindows.filter(this.hash).show();
  12.         $('div#tabs ul.tabNavigation a').removeClass('selected');
  13.         $(this).addClass('selected');
  14.         return false;
  15.     }).filter(selectTabId).click();
  16. });
  17. </script>
  18.  
  19. <div id="tabs" class="tabnavigation">
  20.     <asp:HiddenField runat="server" ID="selectdTab" Value="tabProjects" />
  21.     <ul class="tabNavigation">
  22.         <li><a href="#tabProjects" class="selected"><span>Projects</span></a></li>
  23.         <li><a href="#tabPositions"><span>Positions</span></a></li>
  24.         <li><a href="#tabSkils"><span>Skills</span></a></li>
  25.     </ul>
  26.     <div style="clear: both"></div>
  27. </div>
  28. <div id="tabs" class="tabcontent">
  29.     <div class="tabbedWindow" id="tabProjects" style="alignment-baseline:central; width: 99%">
  30.         <h1>Projects</h1>
  31.     </div>
  32.    
  33.     <div class="tabbedWindow" id="tabPositions" style="alignment-baseline:central; width: 99%">
  34.         <h1>Positions</h1>
  35.     </div>
  36.    
  37.     <div class="tabbedWindow" id="tabSkils" style="alignment-baseline:central; width: 99%">
  38.         <h1>Skills</h1>
  39.     </div>
  40. </div>
  41.  
  42. // Tabbed.ascx.cs
  43. using System;
  44. using System.Web.UI.HtmlControls;
  45.  
  46. public partial class TabbedEmployeesFilter : System.Web.UI.UserControl
  47. {
  48.     protected void Page_Load(object sender, EventArgs e)
  49.     {
  50.         HtmlLink cssLink = new HtmlLink();
  51.         cssLink.Href = ResolveUrl("~/Styles/tabs.css");
  52.         cssLink.Attributes["rel"] = "stylesheet";
  53.         cssLink.Attributes["type"] = "text/css";
  54.         Page.Header.Controls.Add(cssLink);
  55.  
  56.         Page.DataBind();
  57.     }
  58. }
  59.  
  60. // Tabs.css
  61. /* STYLE */
  62.  
  63. .tabnavigation{
  64.     font-family: Arial, Helvetica, sans-serif;
  65.     font-size: 9pt;
  66.     font-weight: normal;
  67.     color: #000;
  68.     /*border-left: 1px #dbe1e6 solid;
  69.     border-right: 1px #dbe1e6 solid;*/
  70. }
  71.  
  72. .tabcontent{
  73.     font-family: Arial, Helvetica, sans-serif;
  74.     font-size: 9pt;
  75.     /*border: 1px #dbe1e6 solid;*/
  76.     background-color: #FFF;
  77. }
  78.  
  79. #tabs ul.tabNavigation{
  80.     /*background:url("tabyahoograd.gif") transparent repeat-x;*/
  81.     /*border-top: 1px #dbe1e6 solid;*/
  82.     border: 1px #dbe1e6 solid;
  83.     margin: 0;
  84.     padding: 0;
  85.     list-style: none;
  86.     height: 35px;
  87. }
  88.  
  89. #tabs ul.tabNavigation li{
  90.     float: left;
  91.     padding: 0;
  92.     margin: 0;
  93. }
  94.  
  95. #tabs ul.tabNavigation a{
  96.     display: block;
  97.     padding: 10px 5px 10px;
  98.     color: #16387c;
  99.     text-decoration:none;
  100. }
  101.  
  102. #tabs ul.tabNavigation a.selected{
  103.     /*background:url("tabyahoogradsel.gif") transparent repeat-x;*/
  104.     font-weight: bold;
  105.     background-color: #57708a !important;
  106.     color: #FFF;
  107.     border: 1px #2d4458 solid;
  108.     padding: 9px 5 9px;
  109. }
  110.  
  111. #tabs ul.tabNavigation a.selected span{
  112.     /*background:url("tabyahoogradselarrow.gif") transparent no-repeat bottom center;*/
  113.     font-weight: bold;
  114.     background-color: transparent !important;
  115.     padding-bottom: 18px;
  116.     position: relative;
  117.     top: 0px;
  118. }
  119.  
  120. #tabs ul.tabNavigation a span{
  121.     padding: 0 10px;
  122. }
  123.  
  124. .tabbedWindow{
  125.     width: 99.9%;
  126.     padding: 5px;
  127. }
  128.  
  129. #tabs ul.tabNavigation a:hover{
  130.     background-image: none;
  131.     color:#16387c;
  132.     text-decoration: underline;
  133. }
  134.  
  135. #tabs ul.tabNavigation a:hover.selected{
  136.     /*background:url("tabyahoogradsel.gif") transparent repeat-x;*/
  137.     font-weight: bold;
  138.     background-color: #57708a !important;
  139.     color: #FFF;
  140.     border: 1px #2d4458 solid;
  141.     padding: 9px 5 9px;
  142.     text-decoration: none;
  143. }
Advertisement
Add Comment
Please, Sign In to add comment