- Name List
- CSS Class [ul/ol].CC_List, li.li[n], li.lin
- Type N/A
The List control allows you to create a bulletted or numbered list of items
including items having sub-lists. It has a number of Add() method overloads
to allow very simple lists - or lists of links that you can style into
menus via CSS. It also has a built in public class called ItemList which
you can spawn independently and populate. The Example and Live tabs show
it in action in a way that this description can not do it justice.
You can also prefix LI items from the ASPX by placing them inline within
the Chan:List tag. The Example and Live tabs' "Zero" item is added this
way. These items are always first in the list and must be defined using
plain <li></li> tags, inline styles or script will break
the parser (it just splits on <li>!). Any HTML within the tags
however will be respected and left intact.
CSS Styling
To aid styling the control's ID is set into the opening OL/UL tag and
each LI within it is classed as li0,li1,li2 ... li[n]. The final/bottom
item in the list is also classed as "lin" for browsers where :last-child
is not supported.
Roadmap
- Yield a little more CSS style-ability, (e.g. LI ID's) to help produce drop down menus etc
- ListItem class should really be elsewhere in the namespace not an internal class
| Qualifiers |
Type |
Name |
Default |
Description |
|
string |
id |
"" |
Unique identifier within the page for the control, this will be placed in th eUL/OL opening tag |
|
bool |
Visible |
true |
Wether or not the control is rendered into the page's HTML. |
|
bool |
Encode |
true |
Wether or not the text within each list item is Html Encoded |
|
bool |
Ordered |
false |
Wether or not the control is ordered (OL) or unorderd (UL) |
| public |
class |
ListItem |
|
A public class which you can spawn and populate, see below. |
Chan.Controls.List.ListItem
| Qualifiers |
Type |
Name |
Default |
Description |
| public |
string |
Text |
"" |
Text to appear within the list item - can be raw HTML if the parent List control's Encode property is set to false. |
| public |
string |
Href |
"" |
If set it will cause the entire LI contents (aside from an ChildList) to be enclosed in an A tag with the given Href. If this starts with "^" then the link will open in a new window. Chan [Root] escape paths may also be used. |
|
bool |
Selected |
false |
Wether or not the class name "Selected" appears in the LI tags class attribute |
|
bool |
ForceNoEncode |
false |
When true the text property will not be html-encoded, even if the parent List's Encode property is true |
|
Controls.List |
ChildList |
null |
If set then the ChildList will be rendered into this ListItem's LI tag, allowing you to create sublists/menus. |
| Qualifiers |
Type |
Name |
Params |
Description |
|
|
Add |
(string Text) |
Add a simple item to the list |
|
|
Add |
(string Text , string Href) |
Add a simple linked item to the list |
|
|
Add |
(string Text , string Href, string Class) |
Add a simple linked item to the list having "the given classname in the LI's class attribute, pass in Href as "" to produce a LI without a link but with the class attribute. |
|
|
Add |
(string Text , string Href, bool Selected) |
Add a simple linked item to the list having "Selected" in the LI's class attribute |
|
|
Add |
( Chan.Controls.ListItem item ) |
Add a ListItem to the list |
This live demo illustrates the effect of the code as shown in the Example
tab but may be altered slightly to fit in with this site's own operating
environment.