I am inside a Repeater, and I'm trying to call the IsExperienced
function from CssClass (as I usually do):
<asp:LinkButton
ID="CheckBox"
CssClass='wall-item-checkbox <%# IsExperienced() %>'
runat="server"
onclick="CallFunction">
</asp:LinkButton>
but this time it prints class=wall-item-checkbox <%# IsExperienced() %>
on the HTML.
Seems like an odd approach in the first place given that you can access that control within the repeater ItemDataBound
event, better to separate code from markup.
Why don't you do this instead:
protected void fooRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
LinkButton lnkButton = (LinkButton)e.Item.FindControl("CheckBox");
lnkButton.CssClass += string.Format(" {0}", IsExperienced());
}
}