Why do ASP.NET TreeView nodes align middle - asp.net

Why do ASP.NET TreeView nodes vertically align middle by default? Is there a way around it? I want to have a full page height TreeView with nodes aligning top. This simple line creates a TreeView with nodes appearing in the middle of the TreeView:
<asp:TreeView runat="server" ImageSet="Inbox" ID="tvMain" Height="500px" />
This is VS2010 + ASP.NET 4.0 if that has something to do. Plus I'm open to CSS solutions if that is what it takes.

Related

Horizontal scroll bar issue when using rtl style with TreeView

The problem is that the website is very wide. A horizontal scroll bar is added and the width of the page becomes like 10000. The problem happens once I use treeview if the page style is RTL.
If I change the page to LTR or if I remove the treeview, the problem disappears.
Can anyone help?
set this property for treeview
SkipLinkText=""
<asp:TreeView ID="TreeView1" runat="server" SkipLinkText="">
</asp:TreeView>

Twitter Bootstrap `container` divs in ASP.Net WebForms

I have found some info on container use in Several containers at one page and Twitter Bootstrap Containers, but was left wanting a bit more input.
From Twitter Bootstrap's own example we see multiple container divs on the same page. But what about ASP.Net MasterPages and UserControls.
Should a single container be used on the Master, therefore enclosing all Content areas in a single top-level container (and then the Content pages would be comprised of row divs)? Or should the container div be pushed down to the Content page?
And taking this one step further, what about a rather complicated UserControl (.ascx) that is comprised of several row divs; should the ascx markup have its own container, or start with a row div assuming the containing page has an enclosing container?
Finally, more generally, does anyone have a rule-of-thumb regarding when to use a new container div?
I put the container div in my master page since all my pages will be using the row/span's in the child pages. In the unlikely event that I want my child page to not use the container, I simply close the div tags...
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
</div> <!-- ending the container -->
<!-- whatever -->
<div> <!-- the master page ends the container div, so we'll add this instead -->
</asp:Content>
A few helpful hints with bootstrap and asp.net...
Radio buttons and checkboxes.
The text appears underneath the radio/checkbox. Fix this by nesting your asp.net radio button list control or similar control inside a div with the radio css class or checkbox css class, and setting the RepeatLayout to flow.
<div class="radio">
<asp:RadioButtonList ID="rblFleettype" runat="server" RepeatLayout="Flow">
<asp:ListItem Selected="True">Item 1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
</asp:RadioButtonList>
</div>
Alerts for error messages.
A lot of asp.net controls can be converted to templates to expose the error literals/labels, then you can apply CssClass="alert alert-error" to the error label. But if you do this it will show the red error boundaries even when there is no error yet. To fix that you can use the PreRender event for the literal/label to check the Text property and see if it's empty, and then set the Visibility property accordingly.

Div produced from an ASP.Net GridView is too large

I have an ASP.Net GridView with properties like so:
<asp:GridView ID="grdOrderEntry" runat="server" AutoGenerateColumns="false" ShowFooter="True"
DataKeyNames="oid" Height="100%">
When I view the control in the browser, there is a lot of white space after the control. When viewing the HTML, the div that is produced by the GridView is much larger than the control, causing the whitespace. Is there a property I can set on the GridView to make the div as small as possible?
If you set the CssClass property you will be able to create some css to address the problem. I would recommend using a live css editor so you can mess around with it until you get the desired effect.
I suspect this is being caused by your Height="100%" attribute, remove that, and it should just stretch around the table it contains (unless there is some css other style added to it as well).

set tab pages on left side of tab continer in asp.net 4.0

I want to ask you about tab containers. Is there any way to set tab pages vertically on left side of tab container. some kind of vertical tab...
Example
tabheader
tabheader (active tab) --- content
Are you talking about ASP.Net Ajax Tabcontainer?
If so, have a look at following link: Making the AjaxToolKit TabContainer tabs vertical
The guy used simple css to get the TabContainer showing vertcal instead of horizontal.

ASP.Net Vertical Menu with Scroll functionality

Referring to Menu / Scrolling Example
I would like to create / find the same functionality for a vertical menu. I tried the following.
<asp:Menu ID="menuAccountMembers" runat="server" StaticSubMenuIndent="16px"
Visible="true" RenderingMode="Table"
ScrollDownImageUrl="~/Resources/scrolldown.jpg"
ScrollUpImageUrl="~/Resources/scrollup.jpg">
<Items>
But it doesnt display any scrolling images. I am using .net 4.0
Tried setting menuAccountMembers.RenderingCompatibility = new Version(3, 5); as well.
If there a property to only display the first 5 root menu items, then show scroll bars for the rest? It can be click-able, no need to hover over to show next item.
Found the Jcarousel sufficient

Resources