J
JJ
I'm sure this is quite simple, but clearly not for me today:
How do you set the CSS Style of a tag in a repeater Item Template?
e.g. I have this repeater:
<asp:Repeater runat="server" ID="rpt_SubCategoryList"
OnItemCreated="rpt_SubCategoryList_ItemCreated">
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li><a href=' '>Some Text Here</a></li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
....and I want to change the class of the '<li>' tag in the ItemTemplate
based on a query string setting:
protected void rpt_SubCategoryList_ItemCreated(Object Sender,
RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
//if current query string is x and is the same as
the current repeater item ID then
// set the cssclass of the ItemTemplate's <li> tag
to "myCssClass"
}
}
I am not sure how I access the itemTemplate's tags?
Thanks in advance
JJ
How do you set the CSS Style of a tag in a repeater Item Template?
e.g. I have this repeater:
<asp:Repeater runat="server" ID="rpt_SubCategoryList"
OnItemCreated="rpt_SubCategoryList_ItemCreated">
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li><a href=' '>Some Text Here</a></li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
....and I want to change the class of the '<li>' tag in the ItemTemplate
based on a query string setting:
protected void rpt_SubCategoryList_ItemCreated(Object Sender,
RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
//if current query string is x and is the same as
the current repeater item ID then
// set the cssclass of the ItemTemplate's <li> tag
to "myCssClass"
}
}
I am not sure how I access the itemTemplate's tags?
Thanks in advance
JJ