ASP Menu float property is not working - html

I have an asp menu, I want to float it to left so the element after it can come to its right side (beside) it. I've set a CssClass for the Menu and added float: leftto it, but it is not working. I've even changed the float:left to float:right to see if it will work or not, but nothing worked.
Here is my code:
<form id="form1" runat="server">
<div class="wrapper">
<div class="navbar">
/*some code*/
</div>
<div class="middle">
<asp:Menu ID="MenuRec" runat="server" CssClass="recFriends">
<Items>
<asp:MenuItem Text="People you may know:" Selectable="false" Enabled="false"></asp:MenuItem>
<asp:MenuItem Text="<br/>" Selectable="false" Enabled="false"></asp:MenuItem>
</Items>
<Items>
<asp:MenuItem Text=" Item1" Selectable="false"></asp:MenuItem>
<asp:MenuItem Text=" Item2" Selectable="false"></asp:MenuItem>
<asp:MenuItem Text=" Item3" Selectable="false"></asp:MenuItem>
</Items>
</asp:Menu>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
<!--here goes the customized content-->
</asp:ContentPlaceHolder>
</div>
<div class="footer">
</div>
</div>
</form>
</body>
My CSS:
.recFriends {
float:left;
padding-top:1em;
color:#003366;
font-weight:normal;
font-style:italic;
}
controls inside the ContentPlaceHolder (which will be in a page that inherits from this master page) must come to the right of the menu, but these are coming below it instead.
I've searched a lot, but nothing worked, I've even checked the solutions available here:
CssClass is not working for my asp menu - all code attached
asp Menu control not floating properly
Can anyone tell me how to solve this problem?
Thank you.

Wrap your menu in a div and close the div before the content place holder. Move your CSS class from the menu to the container div.
HTML
<div class="recFriends">
<asp:Menu ID="MenuRec" runat="server">
<Items>
<asp:MenuItem Text="People you may know:" Selectable="false" Enabled="false"></asp:MenuItem>
<asp:MenuItem Text="<br/>" Selectable="false" Enabled="false"></asp:MenuItem>
</Items>
<Items>
<asp:MenuItem Text=" Item1" Selectable="false"></asp:MenuItem>
<asp:MenuItem Text=" Item2" Selectable="false"></asp:MenuItem>
<asp:MenuItem Text=" Item3" Selectable="false"></asp:MenuItem>
</Items>
</asp:Menu>
</div>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
<!--here goes the customized content-->
</asp:ContentPlaceHolder>
CSS
.recFriends {
float: left;
padding-top: 1em;
color: #003366;
font-weight: normal;
font-style: italic;
width: 20%;
padding-left: 2em;
}

Related

how can i set asp.net gridview to center of div?

I have a asp.net grid view,and i want this gridview show center of the div,i write this css and html code:
<div style="color: #FFFFFF;" class='center' >
شرکت هایی که درمعاونت تجاری ثبت نشده اند<br />
<br />
<asp:GridView ID="GridView1" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None">
<AlternatingRowStyle BackColor="PaleGoldenrod" />
<FooterStyle BackColor="Tan" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<SortedAscendingCellStyle BackColor="#FAFAE7" />
<SortedAscendingHeaderStyle BackColor="#DAC09E" />
<SortedDescendingCellStyle BackColor="#E1DB9C" />
<SortedDescendingHeaderStyle BackColor="#C2A47B" />
</asp:GridView>
</div>
and center css is:
.center {
width:800px;
border-radius: 5px;
width: 60%;
height:200px;
margin: 0 auto;
}​
but gridview show this:
how can i solve that?thanks.
Add align="center" in
Like this
<div align="center" style="color: #FFFFFF;" class='center' >
And remove extra style from .center class. You have assigned width 2 time. % and px.

Table cell width alignments

I have a table set to width=100%, with 2 columns.
How do I make the first table data to take the size of a menu control (inside td1), then make td2 take the size of the remaining space.
If I set td2's width to 100%, my menu collapses/wraps-up.
Here is my code below:
<table border="1" width="100%">
<tr>
<td>
<asp:Menu ID="Menu" runat="server" Orientation="Horizontal">
<Items>
<asp:MenuItem Text="Home" Value="Home"></asp:MenuItem>
<asp:MenuItem Text="ContactUs" Value="ContactUs"></asp:MenuItem>
<asp:MenuItem Text="About Us" Value="About Us"></asp:MenuItem>
</Items>
</asp:Menu>
</td>
<td>TD2</td>
</tr>
</table>
Try the following:
<div class="row">
<div class="col-md-4"> Your menu here</div>
<div class="col-md-8">Content here </div>
</div>
You will need bootstrap.

ASP.NET StaticMenuItemStyle-CssClass attribute does not display correct style

I have a CssClass that I want to set to the StaticMenuItemStyle-CssClass attribute. In the design view the menu has all of the style attributes. But when I run it, none of the attributes are displaying. The background is white and text is blue.
This is the CssClass:
.StaticMenuStyle
{
font-family:Times New Roman;
color: White;
background-color: #006a54;
border: thin outset #A9A9A9;
font-weight: bold;
font-size: medium;
padding-top:5px;
padding-bottom:5px;
padding-left: 10px;
padding-right: 20px;
}
This is the menu that I want to attribute to the CssClass:
<table class="style1" cellpadding="0px" align="left">
<tr valign="top">
<td id="cell_menu" valign="top">
<asp:Panel ID="pnlMenu" runat="server" CssClass="panelMenu" ScrollBars="None" >
<asp:Menu ID="MainMenu" runat="server" StaticMenuItemStyle-CssClass="StaticMenuStyle">
<Items>
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="Create Message"/>
<asp:MenuItem NavigateUrl="~/About.aspx" Text="Edit Profile"/>
<asp:MenuItem NavigateUrl="~/About.aspx" Text="Edit Group"/>
<asp:MenuItem NavigateUrl="~/About.aspx" Text="Message Report"/>
<asp:MenuItem NavigateUrl="~/About.aspx" Text="Admin"/>
</Items>
</asp:Menu>
</asp:Panel>
</td>
<td id="cell_content" class="panelContent">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</td>
</tr>
</table>
Please ignore the multiple About.aspx pages they are placeholders.
If I add all of the individual style elements to the it displays fine. But I would rather put them all in a CssClass.
I also tried using
but that does not work either.
What am I doing wrong?
Thanks,
OK. Now, it is picking up the CssClass and displaying the correct style. I guess I just needed to clean out the cache.

Removing bullets from asp.net menu

I can't seem to get rid of bullets in my menu. Can anyone help me?
Master page code:
<asp:Menu ClientIDMode="Static" ID="main_menu" runat="server" Orientation="Horizontal">
<StaticItemTemplate>
<div class="nav_style">
<asp:Label runat="server" Text='<%# Eval("Text") %>' />
</div>
</StaticItemTemplate>
<Items>
<asp:MenuItem NavigateUrl="~/home.aspx" Text="home" />
<asp:MenuItem NavigateUrl="~/what-it-can-do.aspx" Text="what it can do" />
<asp:MenuItem NavigateUrl="#" Text="pricing" />
<asp:MenuItem NavigateUrl="#" Text="news & events" />
<asp:MenuItem NavigateUrl="#" Text="partner with us" />
</Items>
</asp:Menu>
Here is my CSS code:
.nav_style
{
list-style-type:none;
background-color:#242C32;
border-radius:3px;
color:#F5F5F5;
border-top:6px solid #242C32;
border-bottom:6px solid #242C32;
border-left:12px solid #242C32;
border-right:12px solid #242C32;
font:13px calibri;
}
Here is the generated HTML:
<div id="main_menu">
<ul class="level1">
<li><a class="level1 selected" href="home.aspx">
<div class="nav_style">
<span>home</span>
</div>
</a></li><li><a class="level1" href="what-it-can-do.aspx">
<div class="nav_style">
<span>what it can do</span>
</div>
</a></li><li><a class="level1" href="#">
<div class="nav_style">
<span>pricing</span>
</div>
</a></li><li><a class="level1" href="#">
<div class="nav_style">
<span>news & events</span>
</div>
</a></li><li><a class="level1" href="#">
<div class="nav_style">
<span>partner with us</span>
</div>
</a></li>
</ul>
</div>
EDIT
Not any of the answers seems to be working for me, any other suggestions? Thank you.
Managed to do it myself. In my css file there was a background set for bullets for the whole page
background:url('../img/blue_bullet.png')
so I added to my css
.nav_style li
{
background:none;
}
Redefine the css style as:
.nav_style ul
{
...
}
Remove nav_style class from the div. Instead use CssClass = "nav_style" in the Menu markup.
FYI, just came on this and nothing mentioned worked. Examining the rendered html shows that a table cell was being appended to my list item (the whole menu is a table rendered structure) and using a bullet icon as a background image from webkit. To override that, specify your own bullet, which in my case, was nothing. So I made a 2x2px white png file and specified the "static pop up image url" (StaticPopoutImageURL) control property which is used as the bullet cell's background. The following is in the menu control layout code:
<asp:Menu ID="MyMenu" runat="server"
DisappearAfter="100"
StaticDisplayLevels="1"
Orientation="Vertical"
StaticPopoutImageURL="/Images/White2x2px.png"
CssClass="my anchor/ul styles">
.....
</asp:Menu>
Hopes this helps someone since I couldn't find the answer anywhere.
Jim
Try this:
#main_menu ul
{
list-style:none;
}
Try this to reset it with css:
#main_menu *
{
list-style: none;
}
Demo
For your generated HTML, the following block should get you rid of the bullets.
.level1
{
list-style:none;
}
A more generic way is to target the generated <ul> with something like the following:
#main_menu ul
{
list-style:none;
}
A working example: http://jsfiddle.net/U2Vgf/1/

Ajax Accordion Style Issue

I am having a few style issues with an accordion, when the screen is rendered the accordion is displayed properly, however whenever the expanded pane is changed the bottom of the last accordion pane is hidden.
The accordion is stored in a content placeholder within a master page, the content placeholder on the master page is within a div with no height specified.
EDIT - It seems the accordion is calculating its height incorrectly, so when using the developer toolbar in IE you can see the accordion height automatically updates whenever the tab is changed, incorrectly.
When the screen is rendered -
After clicking on a different pane -
The HTML is -
Page with the issue -
<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolderMain">
<h2 style="width: 836px">Manage Fields</h2>
<br />
<cc1:Accordion ID="uxAccordion" runat="server" SelectedIndex="2">
<Panes>
<cc1:AccordionPane ID="pane1" runat="server" ContentCssClass="accordionContent" HeaderCssClass="accordionHead" BorderStyle="Solid" BorderWidth="1" BorderColor="Black">
<Header>
<h3>> Custom Categories</h3>
</Header>
<Content>
<div class="accordionInnerContainer">
<uc1:CustomCategories ID="CustomCategories1" runat="server" />
</div>
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane ID="pane2" runat="server" ContentCssClass="accordionContent" HeaderCssClass="accordionHead" BorderStyle="Solid" BorderWidth="1" BorderColor="Black">
<Header>
<h3>> Custom Fields</h3>
</Header>
<Content>
<div class="accordionInnerContainer">
<uc2:CustomFields ID="CustomFields1" runat="server" />
</div>
</Content>
</cc1:AccordionPane>
<cc1:AccordionPane ID="pane3" runat="server" ContentCssClass="accordionContent" HeaderCssClass="accordionHead" BorderStyle="Solid" BorderWidth="1" BorderColor="Black">
<Header>
<h3>> Custom Help</h3>
</Header>
<Content>
<div class="accordionInnerContainer">
<uc3:CustomHelp ID="CustomHelp2" runat="server" />
</div>
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>
</asp:Content>
Master Page -
<body class="onecol">
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div id="bodyContainer">
<div id="headerContainer">
<uc2:UserPanel id="UserPanel1" runat="server"></uc2:UserPanel>
<uc3:PrimaryNav ID="PrimaryNav1" runat="server" />
</div>
<div id="mainContainer">
<asp:ContentPlaceHolder ID="ContentPlaceHolderMain" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="subNav">
<p> </p>
</div>
<div id="sideContainer">
</div>
<div id="footer">
<uc1:footer ID="Footer1" runat="server" />
</div>
</div>
</form>
</body>
Css -
body{font: 72% arial,sans-serif;text-align:center}
div#bodyContainer{text-align:left;width:900px;margin:0 auto;background-color:#FFF;}
div#headerContainer{background:url(../images/headerbackgrad.jpg) repeat-x;height:116px;}
div#mainContainer{float:left;width:100%}
div#contentContainer{margin: 0 470px 0 0}
div#subNav{float:left;width:150px;margin-left:-700px}
div#subNav{display:none;}
div#sideContainer{float:left;width:400px;margin-left:-420px}
div#footer{clear:left;width:100%}
div#mainContainer{min-height:400px;_height:400px;}
.accordionHead
{
padding: 1px;
font-weight:bold;
background-color:#ceeffe;
border-bottom: 1px solid black;
}
.accordionContent
{
}
.accordionInnerContainer
{
width: 850px;
padding-left: 5px;
}
Thanks in advance for any help.
Found a solution, setting the following on the accordion sorts the problem -
AutoSize="Limit"