简体   繁体   English

在ASP.net中使用Fancybox(jQuery插件)

[英]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. 我试图在我的ASP.net应用程序(使用Visual Studio)中获得一行代码以出现在Jquery“ Fancybox”窗口中。 I know how to do this with a regular href link. 我知道如何使用常规的href链接执行此操作。 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: 这是我想调用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; 如果我进入CS文件并查找hypPrint,则其定义为:(例如HyperLink中的e.Row.FindControl(“ hypPrint”))。NavigateUrl =“ PrintTicket.aspx?ticketid =” + id;

Basically I have to have this hyperlink call a defined ID for fancybox, called in the Head. 基本上,我必须让此超链接为fancybox定义一个ID,在Head中调用。 I would appreciate any help any ASP.Net experts can provide me! 任何ASP.Net专家都能为我提供的任何帮助,我将不胜感激!

The quick and dirty way to do this would be to use the 'class' attribute as the selector for the fancybox plugin: 快速而肮脏的方法是使用'class'属性作为fancybox插件的选择器:

$('.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. 这应该为您解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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