Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top