开发者

<script> tag get disappeared from rendered HTML after ajax postback action

开发者 https://www.devze.com 2023-02-27 06:59 出处:网络
I have a webpage with one <asp:updatePanel&开发者_开发百科gt;. In the end of the webpage, some javascript method is added and called such as :-

I have a webpage with one <asp:updatePanel&开发者_开发百科gt;. In the end of the webpage, some javascript method is added and called such as :-

The updatePanel code used is as follows:-

   <asp:UpdatePanel ID="UpdatePanel1" runat="server">
          <ContentTemplate>
                    Some controls like repeater etc..
          </ContentTemplate>
    </asp:UpdatePanel>

<script type="text/javascript">
    alert('hi');
    MethodCall();   
</script>

After some ajax postback action happened on the page, when i see the webpage html using the "View Source". The script tag code area gets disappeared from the webpage html. And this causes the problem at the place where js method is called.

I don't understand why this is happening? Why it is removing the JS code block after the ajax postback action.

Pls suggest some workaround or any solution to my problem.

Thx


You can also add the following js function, that is called by the ASP.Net AJAX client script library.

 function pageLoad(sender, args)
    {
       if (args.get_isPartialLoad())
       {
           get_isPartialLoad is true when a partial postback has occurred.
       }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消