Here is the difference between synchronous registration JS and asynchronous Registration JS
Synchronous Registration JS:registerclientscriptblock, equivalent to the beginning of the form (immediately after the
Asynchronous registration JS:registerstartupscript, a script block is sent at the end of the form (before the identity), executed after the document is loaded, and equivalent to the contents of Body.onload=f () {}. To wait until the HTML node element render is complete before loading JS
stringScript ="var iseteditinputrealonly;function seteditinputrealonly () {$ (' input[type=text],textarea,select '). attr (' Disabled ', ' disabled '); $ (' table[class=edittable][projectcurrencyexchangerate=1] '). FIND (' img '). Hide (); $ (' table[ Class=edittable][projectcurrencyexchangerate=1]. Find (' tr[class=head] '). Find (' div '). EQ (0). Hide (); $ (' #ctl00_ Body_cycleandscenario_ddlcycle, #ctl00_body_CycleAndScenario_ddlScenario '). Removeattr (' disabled '); if ($ (' table[ Class=edittable][projectcurrencyexchangerate=1] '). FIND (' img '). length>0) {clearinterval (iseteditinputrealonly )}$ (' input[type=submit] '). Click (Function (Event) {$ (' #divImgWait '). Hide (); Event.preventdefault ()})}$ (document). Ready (function () {Iseteditinputrealonly=setinterval (' seteditinputrealonly () ', +)});"; //registering JavaScript asynchronouslySystem.Web.UI.ScriptManager.RegisterStartupScript (Context.page, ((syspage) context.page). GetType (), Guid.NewGuid (). ToString (), script,true); //Register JavaScript synchronouslyPage.ClientScript.RegisterClientScriptBlock (Context.page, ((syspage) context.page). GetType (), Guid.NewGuid (). ToString (), script,true);
C # The difference between RegisterStartupScript and registerclientscriptblock that synchronizes or asynchronously registers JavaScript to a page from background code