简体   繁体   中英

ASP.NET Repeater with FancyBox Inline html

I'm trying to have a repeater which shows items from a database, and then a modify button at the end which opens up a modify form in a fancy box. I am able to make inline HTML appear in a fancybox just fine following the tutorials from the website. However, the issue is when I try to do this within a .net repeater.

<asp:Repeater ID="ModifyRepeater" runat="server">
    <ItemTemplate>

    <a class="modify" href="#fancy_<%#Eval("ID")%>">Modify</a>

    <div style="display:none">
       <div id="#fancy_<%#Eval("ID")%>">Some content here</div>
    </div>

    </ItemTemplate>
</asp:Repeater>

Javascript:

$(document).ready(function () {
    $(".modify").fancybox(); 
});

When I load the page, I can see the content divs are created with the correct ID's, and the HREFS on the links are pointing to the correct ID as well.

When I click the button to modify, it just reloads the entire page inside the fancybox.

In the console, I will see it says "Uncaught TypeError: Canot call method 'width' of undefined

Thanks to Xander, I mistakenly added the extra # in the ID field of the div. Removing this fixed it cheers!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM