Click here to Skip to main content
16,018,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
use jQuery and updatepanal in my page first time it properly working but update my updatepanale it not working. use postback triger so that working, it that possible jquery workig in updatepanal without postback triger.
Posted

HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="jquery-2.1.3.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        //JS working issue demo by click on link

        //Below code works every time

        function pageLoad(sender, args) {
            $('#hyplink').click(function (e) {
                alert('sdf');
            });
        }

        //Below code works only one time it's not worked after you click on Update Button
        //$(document).ready(function () {
        //    $('#hyplink').click(function (e) {
        //        alert('sdf');
        //    });
        //});

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="up1" runat="server">
            <ContentTemplate>
                <asp:HyperLink ID="hyplink" runat="server" ClientIDMode="Static" Text="">Click On Link</asp:HyperLink>
                <asp:Button ID="btnTest" runat="server" Text="Update" OnClientClick="" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>
 
Share this answer
 
v2
if you used

JavaScript
$(document).ready(function (){
//.....
});


Then it called only one time it's not worked in updatepanel
but if you want to re-use the js every time then use below code.

JavaScript
function pageLoad(sender, args) 
{
//put your code here....
}
 
Share this answer
 
Comments
Piyush Kanpariya 17-Jul-15 1:15am    
any example

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900