javascript - Open a fancybox when the hyperlinkfield of gridview is clicked -


i have gridview has hyperlinkfield.when field clicked,i want fancy box open , in fancy box want iframe display page hyperlinkfield has open.

my gridview is:

<asp:gridview id="gridview" runat="server" autogeneratecolumns="false"datakeynames="srnumber"                     onrowdatabound="gridview2_rowdatabound"                      width="100%"                     showfooter="false"                     enableviewstate="false"                     autopostback="true">                     <columns>       <asp:hyperlinkfield datanavigateurlfields="srnumber" datanavigateurlformatstring="newpage.aspx?srnumber={0}" datatextfield="note"  headertext=""/>                    <asp:templatefield headertext="note" sortexpression="note">                    <itemtemplate>                        <a id="ahrefclick" class="forpopup"  href="newpage.aspx?srnumber  <%#eval("srnumber")%>"><%#eval("note")%></a>                    </itemtemplate>                    </asp:templatefield>                     </columns>                 </asp:gridview> 

currently,there 2 columns , both same. hyperlinkfiled taking me next page. , waa trying add fancy box logic gridview using template field.

the javascript code is:

 $("#ahrefclick").click(function (e) {          $(".forpopupgrid").fancybox({             'titleposition': 'inside',             'transitionin': 'elastic',             'transitionout': 'none'         });     }); 

i still not getting pop up.i new fancybox.please help!

thank you!

edit: jquery , fancybox links are:

    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />     <script src="http://code.jquery.com/jquery-1.9.1.js"></script>     <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>     <script src="http://fancybox.net/js/fancybox-1.3.4/jquery.fancybox-1.3.4.js" type="text/javascript"></script>      <link href="http://fancybox.net/js/fancybox-1.3.4/jquery.fancybox-1.3.4.css" rel="stylesheet"         type="text/css" /> 

try targeting class of actual link this

$(".forpopup").fancybox({    'titleposition': 'inside',    'transitionin': 'elastic',    'transitionout': 'none',    'type': 'iframe' //<-- if opening external pages }); 

... don't need click() method (fancybox triggered once selector bound it)


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -