I create an html and set it to a literalControl.
Then I’m trying to insert this literalControl in a repeater’s ItemTemplate.
But when I do this, it is seen as “System.Web.UI.LiteralControl” text, not the html inside.
Here’s the code:
<asp:Repeater>
//SomeColumns
<ItemTemplate>
<%# GetPriorityBox(DataBinder.Eval(Container.DataItem, "StartDate"),
DataBinder.Eval(Container.DataItem, "EndDate") %>
</ItemTemplate>
</asp:Repeater>
It is seen from the browser like:
SomeColumn | SomeColumn | System.Web.UI.LiteralControl
Just add the markup directly to the ItemTemplate. Change your
GetPriorityBoxmethod to return the Text property of the LiteralControl.