Delving quickly into the code, below you will find the asp.net markup for an accordion that serves as a container for topic headlines as headers for each panel. The contents of these panels are comments to be moderated.
<ajaxToolkit:Accordion runat="server" id="accCommentTrash" fadetransitions="true"
selectedindex="-1" requireopenedpane="false" autosize="None" headercssclass="accTitle"
headerselectedcssclass="accSelectedTitle">
<HeaderTemplate>
<h4>
Title:(<%# ((System.Data.DataRowView)Container.DataItem)["Title"]%>)</h4>
</HeaderTemplate>
<ContentTemplate>
<asp:Repeater runat="server" id="rptrComments" datasource='<%# ((System.Data.DataRowView)Container.DataItem).CreateChildView("CommentRelation") %>'>
<HeaderTemplate>
<ul class="comment_trash">
</HeaderTemplate>
<ItemTemplate>
<li id='<%# new Utilities().encrypt(((System.Data.DataRowView)Container.DataItem)["CommentId"].ToString()) %>'
name='<%# new Utilities().encrypt(((System.Data.DataRowView)Container.DataItem)["CommentId"].ToString()) %>'>
<asp:Label id="lblCommentor" runat="server" text='<%# ((System.Data.DataRowView)Container.DataItem)["AuthorName"] %>'
cssclass=""></asp:Label>
<span>Commented on </span><a href='?id=<%# new Utilities().encrypt(((System.Data.DataRowView)Container.DataItem)["BoardId"].ToString())%>'
title="Click to view board" class="">
<%# ((System.Data.DataRowView)Container.DataItem)["Title"] %>
</a>
<p>
<asp:Label runat="server" id="lblComment" text='<%# ((System.Data.DataRowView)Container.DataItem)["Comment"] %>'
cssclass=""></asp:Label>
</p>
<p>
Trashed about
<%# GetTimeSpan(DateTime.Now,((System.Data.DataRowView)Container.DataItem)["ModifiedOn"].ToString()) %>
hours ago, Commented on
<%# DateTime.Parse(((System.Data.DataRowView)Container.DataItem)["CreatedOn"].ToString()).ToLongDateString() %>
</p>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</ContentTemplate>
</ajaxToolkit:Accordion>
Additionally, here is the javascript event that I have linked to the list items displaying the comments to be moderated. However, only the mouseover and mouseout events seem to work while click events do not function anymore.
//comment restore
if ($get("<%= accCommentTrash.ClientID%>")) {
var li = $get("<%= accCommentTrash.ClientID%>").getElementsByTagName("li");
console.log(li);
for (iloopCounter = 0; iloopCounter < li.length; iloopCounter++) {
$addHandlers(li[iloopCounter], {
mouseover: ul_li_hover,
mouseout: ul_li_hover
});
$addHandler(li[iloopCounter],"click",restoreComment);
}
}
Below is the restore comment function:
function restoreComment(evnt){
console.log(this.name);
console.log(this.id);
}
Despite seeing the list of events in Firebug, they simply don't fire. What could be the issue?