Redirect to page and call JS function

0

I'm redirecting one page to another, but at the time of the redirect I would like to call a function together, so that the time it loads the new page, perform the function, because this function will only be called a few times, page is loaded, is it possible to do this along with the redirect?

Just redirecting the page, I do it this way:

Response.Redirect("Usuarios.aspx");

I need to call these two functions together:

showAlertSucesso();
hideAlertSucesso();

Within the Users.aspx page itself, I call the function in codebehind like this:

ScriptManager.RegisterStartupScript(this, GetType(), "popAlert", "showAlertSucesso();hideAlertSucesso();", true);

I would like to know how I can redirect from the UsuariosB.aspx page, to Usuarios.aspx, and call the functions together.

    
asked by anonymous 21.02.2018 / 20:54

1 answer

0

If I understand correctly, you only need to define the functions, the time that is Redirected will perform its function. In your error you are saying that the function called showAlertSucesso has not been defined.

showAlertSucesso();

function showAlertSucesso(){
   // Coloque o que você precisa fazer aqui
alert("Sucesso");
};
    
21.02.2018 / 21:08