Quantcast
Channel: javascript in update panel
Viewing all articles
Browse latest Browse all 3

javascript in update panel

0
0

salve a tutti sto cercando di capire come fare per far si che del codice javascript venga eseguito all'interno di un updatepanel anche dopo il suo aggiornamento. in un codice come questo

            <script src=jquery-1.5.min.js type="text/javascript"></script>
  <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <CompositeScript>
                <Scripts>
                    <asp:ScriptReference Path="~/JScript.js" />
                </Scripts>
            </CompositeScript>
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />
            </Triggers>
        <ContentTemplate>
                   <input id="Button1" type="button" value="button" class="m" />
            <asp:Label ID="Label1" runat="server" CssClass="l_1" Text="Label"></asp:Label>

        </ContentTemplate>
        </asp:UpdatePanel> 
        <asp:Button ID="Button2" runat="server" Text="Button" />

    </div>
    </form>

il JScript.js invece è semplicemente questo

/// <reference path="jquery-1.5.min.js" />
$(document).ready(function () {

$('#Label1').hover(function () {
    var className = $(this).attr('class');

        $(this).removeClass();
        $(this).addClass('l_2');
});
});

al passaggio del mouse sopra la label1 prima dell'aggiornamento la funzione del file JScript.js mentre dopo l'aggiornamento , quindi dopo aver premuto il button2 la funzione non funziona più.

come posso fare perché il codice javascript venga eseguito all'interno dell'updatepanel anche dopo il suo aggiornamento?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images