Hi,
I am trying to get some jquery to run but I have a feeling it is not working like the tutorial because I am wanting to run it in a user control rather than on the page.
This is the code for the control jquery
and here is the code with the divs i am wanting to show/hideCode:<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SearchOutlines_j.ascx.cs" Inherits="usercontrols_SearchOutlines_j" %> <%@ Register TagPrefix="A" TagName="HelpIcon" Src="~/usercontrols/HelpIcon.ascx" %> <script src="../../scripts/jquery-1.5.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function () { $(".detail").hide(); $(".header").click(function () { $(this).next(".detail").slideToggle(300); }); }); </script>
Has anyone any experience of jquery in user controls on bound items?Code:<div id="listing-container" class="listing-container"> <asp:Repeater ID="Repeater1" runat="server" onitemcommand="Repeater1_ItemCommand"> <HeaderTemplate> <table class="coursetable1" border="0" cellpadding="0" cellspacing="0"> <tr><th class="leftcol" scope="col">TITLE</th><th scope="col">TYPE</th><th scope="col">CODE</th><th scope="col">DAYS</th></tr></HeaderTemplate> <ItemTemplate> <tr><td class="leftcol"><asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/Outlines/Outlines.aspx" oncommand="CourseCodeClick" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Code")%>'><%# DataBinder.Eval(Container.DataItem, "Description")%></asp:LinkButton></td> <td><img alt='<%# DataBinder.Eval(Container.DataItem, "Type")%> Course' title='<%# DataBinder.Eval(Container.DataItem, "Type")%> Course' src='../Outlines/images/<%# DataBinder.Eval(Container.DataItem, "Type")%>.jpg' /></td> <td><%# DataBinder.Eval(Container.DataItem, "Code")%></td> <td><%# DataBinder.Eval(Container.DataItem, "Duration")%></td> <td><div id="header">Detail</div></td></tr> <tr><td><div id="detail">fish</div></td></tr> </ItemTemplate> <AlternatingItemTemplate> <tr class="altrow"><td class="leftcol"><asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/Outlines/Outlines.aspx" oncommand="CodeClick" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Code")%>'><%# DataBinder.Eval(Container.DataItem, "Description")%></asp:LinkButton></td> <td><img alt='<%# DataBinder.Eval(Container.DataItem, "CourseType")%> ' title='<%# DataBinder.Eval(Container.DataItem, "CourseType")%> ' src='../Outlines/images/<%# DataBinder.Eval(Container.DataItem, "Type")%>.jpg' /></td> <td><%# DataBinder.Eval(Container.DataItem, "Code")%></td> <td><%# DataBinder.Eval(Container.DataItem, "Duration")%></td></tr> </AlternatingItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> </div>
EDIT:
I have also added the code
<div id="courseheader">fish</div>
<div id="coursedetail">chips</div>
directly after the script tags. The chips also do not get hidden so the problem definately stems from it being a user control and not because of the repeater. I am also using master pages which could be affecting it!





Reply With Quote