G
Guest
I would like to be able to call methodTrue() when the user clicks yes and
methodFalse() when they click No. How do i accomplish that? here is my code:
private void methodTrue()
{
//method false details
}
private void methodFalse()
{
//method false details
}
public void CreateMessageProm2(System.Web.UI.Page aspxPage, string
strMessage, string strKeyPrompt)
{
try
{
StringBuilder sb = new StringBuilder();
sb.Append("<script language='javascript'>");
sb.Append("var results = window.confirm('" + strMessage + "');");
sb.Append("if (results == true)");
sb.Append("{ alert('The value is true');}"); //call methodTrue
sb.Append("else");
sb.Append("{ alert('the value is false');}"); //call methodFalse
sb.Append("</script>");
string strScript = sb.ToString();
if (!aspxPage.IsStartupScriptRegistered(strKeyPrompt))
{
aspxPage.RegisterStartupScript(strKeyPrompt, strScript);
}
}
catch(Exception exep)
{
string sMessage = exep.Message.ToString();
}
}
methodFalse() when they click No. How do i accomplish that? here is my code:
private void methodTrue()
{
//method false details
}
private void methodFalse()
{
//method false details
}
public void CreateMessageProm2(System.Web.UI.Page aspxPage, string
strMessage, string strKeyPrompt)
{
try
{
StringBuilder sb = new StringBuilder();
sb.Append("<script language='javascript'>");
sb.Append("var results = window.confirm('" + strMessage + "');");
sb.Append("if (results == true)");
sb.Append("{ alert('The value is true');}"); //call methodTrue
sb.Append("else");
sb.Append("{ alert('the value is false');}"); //call methodFalse
sb.Append("</script>");
string strScript = sb.ToString();
if (!aspxPage.IsStartupScriptRegistered(strKeyPrompt))
{
aspxPage.RegisterStartupScript(strKeyPrompt, strScript);
}
}
catch(Exception exep)
{
string sMessage = exep.Message.ToString();
}
}