简体   繁体   中英

Using Fancybox (jquery plugin) in ASP.net

I'm trying to get a line of code in my ASP.net application (using Visual Studio) to appear in a Jquery "Fancybox" window. I know how to do this with a regular href link. However, I'm confused on how to set this up using a dynamically generated one.

Here's my line of code that I would like to call Jquery:

<asp:HyperLink ID="hypPrint" style="margin-left: 5px;" CssClass="btn3" runat="server" Text="View/Print" CausesValidation="false" />

If I go into my CS file and look up hypPrint, here's what it's defined as: (e.Row.FindControl("hypPrint") as HyperLink).NavigateUrl = "PrintTicket.aspx?ticketid=" + id;

Basically I have to have this hyperlink call a defined ID for fancybox, called in the Head. I would appreciate any help any ASP.Net experts can provide me!

The quick and dirty way to do this would be to use the 'class' attribute as the selector for the fancybox plugin:

$('.btn3').fancybox();

Honestly, though, I'd make a more descriptive class and use that instead, but that debate belongs somewhere else. This should do the trick for you.

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