Bonjour,

Voici comment j'ouvre ma FancyBox avec un HyperLink :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
lnk_addtracing.NavigateUrl = "./MessageBox.aspx";
 
 
        lit_addtracing.Text = "<script type=\"text/javascript\"> " +
        "$(\"#" + lnk_addtracing.ClientID + "\").fancybox({" +
            "'onClosed': function() {parent.location.reload(true); ;}," +
            "'autoScale'            : true," +
            "'transitionIn'            : 'none'," +
            "'transitionOut'        : 'none'," +
            "'type'                    : 'iframe'" +
        "});" +
        "</script>";
Ma page .aspx :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title id="lbl_titlePage" runat="server" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="icon" type="image/png" href="http://192.168.100.127/ressources/images/picky.ico" />
 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
 
    <script type="text/javascript" src="./js/jquery.tools.min.js"></script>
 
    <link href="styles.css" type="text/css" rel="stylesheet" />
 
    <script type="text/javascript" src="./fancybox/jquery.mousewheel-3.0.2.pack.js"></script>
 
    <script type="text/javascript" src="./fancybox/jquery.fancybox-1.3.1.js"></script>
 
    <link rel="stylesheet" type="text/css" href="./fancybox/jquery.fancybox-1.3.1.css"
        media="screen" />
</head>
<body>
    <form id="form1" runat="server">
    <asp:HyperLink CssClass="RedLink" runat="server" ID="lnk_addtracing" Text="FancyBox" />
    <asp:Literal runat="server" ID="lit_addtracing"></asp:Literal>
    </form>
</body>
</html>
J'aimerais pourtant ouvrir la FancyBox lors du clic() sur un Button.

Exemple :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
<asp:Button ID="show_fancybox" runat="server" Text="Afficher la MessageBox" OnClick="showFancyBox" />
Mais je ne sais pas quoi mettre dans mon code behind...

Pouvez vous m'aider?

Merci à tous/toutes d'avance pour votre lecture et vos réponses...


Edit : Ou alors lancer l'ouverture de la FancyBox dans mon PageLoad...