Jquery Ui-Dialog confirm form submit
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 :
is it even possible to redirect to an .aspx from the client side (i'm guessing not ..)
if not how would i call the ui-dialog from the aspx page .
how would i detect a post back using jquery ?
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);
}
}
精彩评论