This code from a view component (my impl of a TableComponent) does not what
it should do:
public override void Render()
{
CancelView();
var renderedElements = new List<string>();
foreach (var element in _elements)
{
using (var w = new StringWriter())
{
PropertyBag["item"] = element;
RenderSection("item", w);
renderedElements.Add(w.ToString());
}
}
RenderText(renderedElements.Join("<hr/>"));
}
on the view side I have it like that:
component Table, {...@elements: viewData.Items, @numberCols:
viewData.Pagination.ItemsPerPage/5, @cssClass: "articlesTable"}:
section item:
if item isa ArticleListItem:
component ArticleTile, {...@item: item}
else:
component Tile, {...@title: item.Link.Text, @PageUrl:
item.Link.Url, @PopUpUrl: item.DescriptionUrl, @ImgSrc: item.Image.Url}: %>
<% end
end
end
end
(The c# code right now is made for me to understand the issue better, not
for performance)
Instead of returning the expected result, it only puts those elements into
the list, that themselves have a custom Render() method (like TileComponent,
with cancelview and RenderText(....)) and renders those directly to the
screen, ignoring the passed in TextWriter, that do not. Of course it could
be something else that triggers this, but this is what strikes my eye...
2 questions:
- how can I test this? At best keeping the test within c# and bypassing
views.
- how could I get around this?
--
Jan
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.