javascript yes/no instead of ok/cancel
Is this true? it is not possible to change the content of the buttons in the dialog displayed by the confirm function
This is my code to display a pop-up the our user to confirm his data:
Code:
Queue queue = (Queue)(handlerPages[HttpContext.Current.Handler]);
if ((queue != null))
{
StringBuilder builder = new StringBuilder();
int iMsgCount = queue.Count;
builder.Append("<script language='javascript'>");
string sMsg = string.Empty;
while ((iMsgCount > 0))
{
iMsgCount = iMsgCount - 1;
sMsg = System.Convert.ToString(queue.Dequeue());
sMsg = sMsg.Replace("\"", "'");
string[] QueueArray = sMsg.Split(',');
builder.Append("if(confirm( \"" + QueueArray[0] + "\" )) {");
builder.Append("location.replace('pageA.aspx?');");
builder.Append("} else {");
builder.Append("location.replace('pageB.aspx?');");
builder.Append("}");
}
builder.Append("</script>");
handlerPages.Remove(HttpContext.Current.Handler);
HttpContext.Current.Response.Write(builder.ToString());
}
The user wants to see Yes/No instead of OK/Cancel. It's true I can't use confirm?
I did not write this code and I'll admit I don't understand it, so the first thing I will do is dissect it. But do I also have to rewrite it?
Thanks.
Re: javascript yes/no instead of ok/cancel
The javascript confirm method gives OK Cancel Button only. There is no default method by which you can Have YES / No button. Either you can go Jquery or Design a form which has YES/No button and call the form.
Jquery Example here : http://jqueryui.com/dialog/#modal-confirmation
And Another way here : http://forums.asp.net/t/1800080.aspx/1
Re: javascript yes/no instead of ok/cancel
I believe we are going to use jquery. I will post the solution when it is complete. Thanks.