问题描述
标签颜色显示和标签绑定存在问题.
当我选择选项卡时.颜色将完美显示.
但是,该选项卡没有选择我在diff.color中选择的特定选项卡
有什么问题..?
因此我花了半天...?
请给我我错了的解决方案..?
看到我的代码
-----------
ASPX代码
---------
Hi,
I have a problem with tab color display and tab binding.
when i select the tab. the color will be displaying perfectly.
But, the tab is not selecting what i am selected particular tab in diff.color
what is the problem..?
because of this i have spent half day...?
pls. give me solution where i am wrong..?
see my code
-----------
ASPX Code
---------
<tr>
<td width="100%">
<div id="Div1" class="mattblackmenu">
<asp:Menu id="NavigationMenu" Runat="Server" Orientation="Horizontal"
StaticMenuStyle-VerticalPadding="2"
StaticMenuItemStyle-Font-Name="Verdana"
StaticMenuItemStyle-Font-Size="8pt"
StaticMenuItemStyle-ForeColor="white"
StaticHoverStyle-BackColor="RED"
StaticHoverStyle-ForeColor="RED"
StaticSelectedStyle-Font-Bold="True"
StaticSelectedStyle-BackColor="white"
StaticSelectedStyle-ForeColor="RED">
</div>
</td>
<td style="width:400px; vertical-align:top">
<asp:ContentPlaceHolder id="CONTENT" Runat="Server"/>
</td>
</tr>
类CSS文件()-"class =" mattblackmenu"
-------------------------------------------
Class CSS File () - "class="mattblackmenu"
-------------------------------------------
.mattblackmenu ul{
margin: 0;
padding: 0;
font: bold 11px Verdana;
list-style-type: none;
border-bottom: 1px solid gray;
background: #414141;
overflow: hidden;
width: 100%;
}
.mattblackmenu li{
display: inline;
margin: 0;
}
.mattblackmenu li a
{
float: left;
display: block;
text-decoration: none;
margin: 0;
padding: 5px 8px; /*padding inside each tab*/
border-right: 1px solid white; /*right divider between tabs*/
color: #FFFFFF;
background: #000000;
filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#75808a', startColorstr='#000000', gradientType='0');
}
.mattblackmenu li a:visited{
color: white;
}
.mattblackmenu li a:hover{
background: black; /*background of tabs for hover state */
}
.mattblackmenu a.selected{
background: black; /*background of tab with "selected" class assigned to its LI */
}
/*Modal Popup*/
.modalBackground {
background-color:Gray;
-ms-filter: alpha(opacity=70);
-ms-opacity:0.7;
}
ASPX.VB代码
------------
ASPX.VB Code
------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
MnuItemSelected()
If Not IsPostBack Then
FillMenuData()
End If
'check whether session expires
Me.CheckSessionTimeout()
End Sub
Public Sub FillMenuData()
NavigationMenu.Items.Clear()
Conn.Open()
StrQry = ""
StrQry = " Select isnull(Adm,'') as Admin,isnull(Home,'') as Home,"
StrQry &= " isnull(Proj,'') as Projects
StrQry &= " from Projects where emp_number ='" & Session("EmpNo") & "' "
Cmd.Connection = Conn
Cmd.CommandText = StrQry
Rdr = Cmd.ExecuteReader
If Rdr.HasRows Then
While Rdr.Read
If Rdr("Home") = "Y" Then
Dim mnuItems As New MenuItem()
mnuItems.NavigateUrl = "~\Home.aspx"
mnuItems.Text = "Home"
NavigationMenu.Items.Add(mnuItems)
End If
If Rdr("Adm") = "Y" Then
Dim mnuItems As New MenuItem()
mnuItems.NavigateUrl = "~\Adm.aspx"
mnuItems.Text = "Adm"
NavigationMenu.Items.Add(mnuItems)
End If
If Rdr("Proj") = "Y" Then
Dim mnuItems As New MenuItem()
mnuItems.NavigateUrl = "~\Proj.aspx"
mnuItems.Text = "Proj"
NavigationMenu.Items.Add(mnuItems)
End If
End While
End If
Rdr.Close()
Conn.Close()
End Sub
Private Sub MnuItemSelected()
'-- Get page name from relative path
Dim ThisPage As String = Page.AppRelativeVirtualPath
Dim SlashPos As Integer = InStrRev(ThisPage, "/")
Dim PageName As String = Right(ThisPage, Len(ThisPage) - SlashPos)
'-- Select menu item with matching NavigateUrl property
Dim ParentMenu As New MenuItem
Dim ChildMenu As New MenuItem
NavigationMenu.Items.Clear()
For Each ParentMenu In NavigationMenu.Items
If ParentMenu.NavigateUrl = PageName Then
ParentMenu.Selected = True
Else
For Each ChildMenu In ParentMenu.ChildItems
If ChildMenu.NavigateUrl = PageName Then
ChildMenu.Selected = True
End If
Next
End If
Next
End Sub
推荐答案
这篇关于该选项卡没有选择我正在选择diff.color中的特定选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!