This question is locked. New answers and comments are not allowed.
Hi,
Another question raised when I was implementing TreeView on my site. I need to set each item HtmlAttributes, but unfortunately I didn't find example how this done when using Binding. Below is a code where I have tried to set it. Normally I have done like this: .HtmlAttributes(new {style = "width:1px;"});
| mappings.For<Branch>(binding => binding |
| .ItemDataBound((item, branch) => |
|
{ item.HtmlAttributes = ??? |
| item.Selected = branch.IsSelected; |
| item.Expanded = branch.IsExpanded; |
| item.Encoded = false; |
| item.Text = branch.Name + "<span class=\"treeViewActions\">" + BranchHelper.GetActions(branch) + "</span>"; |
| }) |
| .Children(branch => branch.Versions)); |
| mappings.For<Leaf>(binding => binding |
| .ItemDataBound((item, version) => |
| { |
| item.Selected = version.IsSelected; |
| item.Encoded = false; |
| item.Text = version.Name + "<span style=\"position: absolute; right: 65%;\">" + version.StatusText + "</span><span class=\"treeViewActions\"\">" + ItemHelper.GetVersionActions(version) + "</span>"; |
| })); |
Thanks,
-Tatu