JavaScript ASP.NET Scriptmanager runs after code executed scriptmanager run script after postback,asp.net run script after

I'm using ASP.net 4.5.

I have a method like this:

 protected void OnConfirm(object sender, EventArgs e)
        {

// this function checks if an id exist in database
            CheckIDExist(123);        


//If Id exist I want to give the popup conform prompt to user

           this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Confirm", "Confirm();", true);

and then following code:

             string[]  arrReply =Request.Form["confirm_value"].Split(',');
             string confirmValue = arrReply[arrReply.Length-1];

            if (confirmValue == "Yes")
            {
                //populate the fields
                int y=1;/

            }
            else
            {

                ClearSection1();
}

}

The problem is this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Confirm", "Confirm();", true); Does executed after all other codes. and not in the order expected.

function Confirm() {
    var confirm_value = document.createElement("INPUT");
    confirm_value.type = "hidden";
    confirm_value.name = "confirm_value";
    if (confirm("There is a Survey that is open for thid CID. Do you wish to continue with existing Survey? If you press on Cancel a New Survey will be started.")) {
        confirm_value.value = "Yes";
    } else {
        confirm_value.value = "No";
    }
    document.forms[0].appendChild(confirm_value);

}
Answer:1

I have an array: console.log(tenantArray) (8) ["WeWork", "Regus", "Spaces", "Knotel", "RocketSpace", "HQ Global Workspaces", "Other", "Select All"] I also have a large data object, which I want to ...

I have an array: console.log(tenantArray) (8) ["WeWork", "Regus", "Spaces", "Knotel", "RocketSpace", "HQ Global Workspaces", "Other", "Select All"] I also have a large data object, which I want to ...

  1. iterating through array javascript
  2. iterating through array python
  3. iterating through array java
  4. iterating through array c++
  5. iterating through array matlab
  6. iterating through array ruby
  7. iterating through array bash
  8. iterating through array js
  9. iterating through arraylist
  10. iterating through array php
  11. iterating through array swift
  12. iterating through array of objects javascript
  13. iterating through array powershell
  14. iterating through array in typescript
  15. iterating through array in scala
  16. iterating through array in perl

I make one call that retrieves multiple GUIDs using the WebAPI. I loop through each result and update records accordingly. This is all being done asynchronously. I do not want the user to wait for all ...

I make one call that retrieves multiple GUIDs using the WebAPI. I loop through each result and update records accordingly. This is all being done asynchronously. I do not want the user to wait for all ...

I want to open a specific tab of bootstrap 4 from external page link . Page 1: nav.html I want to go from this page one to second page <!DOCTYPE html> <html> <head> <title&...

I want to open a specific tab of bootstrap 4 from external page link . Page 1: nav.html I want to go from this page one to second page <!DOCTYPE html> <html> <head> <title&...

When i run console.log (f ()) i want it returns the data that came from getData (url), but it keeps returning Promise {<pending>}. I thought using await keyword would solve this by making the ...

When i run console.log (f ()) i want it returns the data that came from getData (url), but it keeps returning Promise {<pending>}. I thought using await keyword would solve this by making the ...