I'm building Bootstrap 3 menu webpart and I need to count the number of child elements. The code below does that, but unfortunately counts all elements (hidden, containers, etc...). I need to count only "Page" elements, or at least elements that I have unchecked from being listed in the main menu.
<%# IfCompare(Eval("NodeChildNodesCount"),0,"class='dropdown-toggle' data-toggle='dropdown' ","") %>
Is there any way I could improve the code above to filter out all that is not a "Page" menu item?
I would suggest that you use a nested repeater which would only load the Page menu item below the selected section in the menu.
You could then provide the list item in the item template to match your CSS.
Related
I searched SO for the best solution to this question, found several clues, while not fully satisfying IMO. So I post below my no-code solution.
The goal is to have, as in Finder or other native applications, a contextual menu on the header bar of a table or outline, allowing to select which columns are visibles.
In IB storyboard, add all the columns you need into the table view.
You may set some of them hidden by default.
Ctrl-drag each column from the IB document outline view to the scene controller code view, in order to automatically create weak IBOutlets for each column. The purpose is to be able to target a given column in bindings.
__weak IBOutlet NSTableColumn *my_column;
Add a menu to the storyboard scene with the same number of item as the columns you plan to hide. You do not have to give title to menu items (see next point).
For each menu item, in the bindings pane, add two bindings :
Bind the item title to the column title property through your controller outlet : controller_name.my_column.title. This way the menu item will stay in sync with column title, should the code need to change it.
THIS ONE IS KEY : Bind the value of the menu item to the column hidden property : controller_name.my_column.hidden. Add a NSNegateBoolean transformer for the menu tick to be meaningful.
Attach the menu to header menu : ctrl-click on the table header view and make connection from the menu outlet to the menu created in #3.
That it's. No code beside the IBOutlets added in #2.
The bindings being two ways, un-ticking a menu item will hide the bound column. Also, if the code hides a column the bound menu item will reflect its state.
Im having problems adding items with Datalist Option, I can see 4 or 5 items there but items are not rendered, just first one.
If I add item from control bar item appears but from itemsgrid, items are not being displayed into app
This question is extremely generic and hard to answer. Please look at some demo-apps, you probably did not include a loop (which would go through all items) and are only showing one in your template.
We are developing a website with a drop down menu. The problem is the menu needs to be dynamic since the Parent and Child will be place under a single menu. This means that a single menu may contain multiple parents with multiple children. These parents/children are coming from a database.
http://imageshack.us/photo/my-images/405/h9o.png/
When hover the set of parent menu and children will be shown
http://imageshack.us/photo/my-images/836/fiz5.png/
The number of rows depends on the number of Parent and Children, The children will always under the parents, Children will not be broken into two different column. Which means the rows and columns are created dynamically based on the data that coming from the database. Any idea how to make this?
There are lots of menu solutions on the net.
I've used JQuery UI menu http://jqueryui.com/menu/ .
Just output your menu items as <li>'s and run the Jquery UI function .menu(); as they do in the example in the link page. The items in the menu can either be links to other pages or postbacks to the same page. If you postback you could in the item assign some value to a hidden field that you check in the code behind.
I have database Structure like below
TblMenu >>
MenuID, MenuName, LinkPath, MenuDesc, MenuPosition, IsParent, ChildID
I am fetching Items at Runtime at Masterpage and want to display items properly with my desired CSS Class but Only Top Level (all items). Now I want to Display Sub-Menu Items also as dropdown. Kindly suggest a way yo get that with ASP.NET and C#.
-John Bhatt
I have a page using a Treeview server control like so:
<asp:TreeView ID="uxTreeView" ShowExpandCollapse="True" ShowCheckBoxes="All" runat="server"></asp:TreeView>
What I expect to have happen is my treeview should render a series of checkboxes, with the first level having a plus sign (+) to expand it, and then a minus sign (-) when it's expanded to collapse it.
For some reason, I'm not seeing the expand/collapse links. I can see there's a parent and a child node, and they're properly nested, but the expand/collapse links aren't showing.
Has anyone seen this before? In the past this hasn't been an issue - dragging and dropping the control onto a page has worked fine. I've inspected the elements with Firebug, and I didn't see any CSS that would hide the expand/collapse links.
UPDATE
I've found there's an ImageSet property on the treeview - now my treeview is actually adding the arrows for the various nodes indicating whether they're expanded or collapsed. Is it possible to style the individual cells in the outputted table? (It looks like this would be a lot of work)
Did you by chance specify custom images, perhaps incorrectly, for the expand and collapse elements?