Css Menu Using Database UL LI in asp.net Repeater:
CSS Style:
<style type="text/css">
#Menu
{
background-color: #84945a;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
margin: 0;
padding: 0;
border-radius: 5px;
webkit-border-radius: 5px;
-moz-border-radius: 5px;
font-family: Verdana;
width: 150px;
list-style: none; /*#707070#A9A9A9*/
}
#Menu li
{
padding: 10px;
font-family: Verdana;
border-bottom: dotted 1px white;
}
#Menu li a
{
color: White;
text-decoration: none;
}
#Menu li:hover li
{
cursor:pointer;
color: #84945a;
background-repeat:no-repeat;
border:dotted 1px #84945a;
}
#Menu li a:hover
{
color:Maroon;
}
#Menu li a:active
{
background-color: White;
color: #84945a;
}
#Menu li ul
{
display: none;
}
. lbl
{
color:#b70b6e;
font-family:Verdana;
font-size:20px;
}
</style>
#Menu
{
background-color: #84945a;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
margin: 0;
padding: 0;
border-radius: 5px;
webkit-border-radius: 5px;
-moz-border-radius: 5px;
font-family: Verdana;
width: 150px;
list-style: none; /*#707070#A9A9A9*/
}
#Menu li
{
padding: 10px;
font-family: Verdana;
border-bottom: dotted 1px white;
}
#Menu li a
{
color: White;
text-decoration: none;
}
#Menu li:hover li
{
cursor:pointer;
color: #84945a;
background-repeat:no-repeat;
border:dotted 1px #84945a;
}
#Menu li a:hover
{
color:Maroon;
}
#Menu li a:active
{
background-color: White;
color: #84945a;
}
#Menu li ul
{
display: none;
}
. lbl
{
color:#b70b6e;
font-family:Verdana;
font-size:20px;
}
</style>
aspx:
<asp:Label Text=":Actor Type:" CssClass="lbl" runat="server">
</asp:label>
</div>
<div style="float:left">
<ul id="Menu">
<asp:Repeater ID="rptMenu" runat="server">
<ItemTemplate>
<li>
<a href="Home.aspx?ID=<%#Eval("ActorName") %>">
<asp:Label ID="txtText" runat="server"
Text='<%#Eval("ActorName") %>'>
</asp:Label></a>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
</div>
aspx:cs C#:
SqlConnection Conn= new SqlConnection(strConnString);
DataSet ds = new DataSet();
Load:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind();
}
}
public void Bind()
{
String Select;
Select = "Select * From Actor";
da = new SqlDataAdapter(Select, Conn);
da.Fill(ds);
rptMenu.DataSource = ds;
rptMenu.DataBind();
}
Screen:
No comments:
Post a Comment