Tuesday 15 April 2014

calling javascript/jquery function in asp.net -


I have an ASPX page in which I use UpdatePanel

Case 1:

  & Lt;% - Some HTML -% & gt; & Lt; ASP: Button ID = "BTNubut" Runat = "Server" OnClientClick = "Return Callfunction ();" Text = "send" /> & Lt; Asp: UpdatePanel runat = "server" & gt; & Lt; ContentTemplate & gt; & Lt;% - Here's some content -%> & Lt; / ContentTemplate & gt; & Lt; Trigger & gt; & Lt;% - async trigger -%> & Lt; / Trigger & gt; & Lt; / ASP: UpdatePanel & gt; & Lt; Script type = "text / javascript" & gt; Function callfunction () {// function is placed between the page alerts ('hello'); } & Lt; / Script & gt; & Lt;% - Some HTML again -%> & Lt; / ASP: Content & gt;   

And if I place my function at the end of the page by calling the function

Case 2:

  & lt; Asp: Content ID = "Content1" runat = "server" ContentPlaceHolderID = "MainContent" & gt; & Lt;% - Some HTML -%> & Lt; ASP: Button ID = "button1" runat = "server" OnClientClick = "return callfunction ();" Text = "send" /> & Lt; Asp: UpdatePanel ID = "Update Panel 1" Runat = "Server" & gt; & Lt; ContentTemplate & gt; & Lt;% - Here's some content -%> & Lt; / ContentTemplate & gt; & Lt; Trigger & gt; & Lt;% - async trigger -%> & Lt; / Trigger & gt; & Lt; / ASP: UpdatePanel & gt; & Lt;% - Some HTML again -%> & Lt; Script type = "text / javascript" & gt; Function callfunction () {// function is placed between the page alerts ('hello'); } & Lt; / Script & gt; & Lt; / ASP: Content & gt;   

So I want to know what is the problem with case 1? Why I am not able to call function

The complete redistribution of the updated panel The causes of the control of the page are controlled by trees and every one control runs through their life cycle events. JQuery and webform generally do not play well I believe you may have problems with nesting, but it is hard to say without looking at the whole page.

No comments:

Post a Comment