开发者

Jquery Ui-Dialog confirm form submit

开发者 https://www.devze.com 2023-04-13 03:05 出处:网络
i got an .aspx page when i press a button \"submit\" and all validation开发者_如何学Python\'s pass the code behind is processed ,

i got an .aspx page when i press a button "submit" and all validation开发者_如何学Python'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 ?


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);
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号