0

i got an .aspx page when i press a button "submit" and all validation's pass the code behind is processed , when it's done i wan't to use the ui-dialog the confirm that notion to the user .

when the user presses ok i wan't the page to redirect back to the main page(different .aspx)

my question's are :

  1. is it even possible to redirect to an .aspx from the client side (i'm guessing not ..)

  2. if not how would i call the ui-dialog from the aspx page .

  3. how would i detect a post back using jquery ?

  4. how would i pull the query string using jquery ?

eran otzap
  • 12,293
  • 20
  • 84
  • 139
  • 2
    http://stackoverflow.com/questions/887029/how-to-implement-confirmation-dialog-in-jquery-ui-dialog/972832#972832 – Rafay Oct 14 '11 at 05:44
  • also pass arguments http://stackoverflow.com/questions/7779044/passing-arguments-to-javascript-function-from-code-behind-error – eran otzap Oct 15 '11 at 23:39

1 Answers1

1

You can call function for show message from code-behind. And yes, it's possible to redirect to an .aspx page from client side. Look at code below:

Javascript:

function showSuccessMessage() {
     $("#dialog-message").dialog({
          modal: true,
          buttons: {
               Ok: function () {
                    $(this).dialog("close");
                    window.location = '<%= ResolveClientUrl("~/Default.aspx") %>';
               }
          }
     });
}

All that you need is inject this function call in server code:

void SubmitButton_Click(object sender, EventArgs e)
{

    // your code here...

    if (IsAsync)
    {
        ScriptManager.RegisterStartupScript(this, this.GetType(), "success", "showSuccessMessage();", true);
    }
    else
    {
        ClientScript.RegisterStartupScript(this.GetType(), "success", "showSuccessMessage();", true);
    }
}
Yuriy Rozhovetskiy
  • 22,270
  • 4
  • 37
  • 68
  • 10x alot :) just one more thing if i may, how would you send an argument to that function i got a user name which i want to send through "showSuccess(Session["user"].toString());" is there a way to push an Eval in there ? – eran otzap Oct 14 '11 at 16:16