Dorababu Meka

Dorababu Meka

  • 226
  • 8.3k
  • 1.7m

Jquery Yes or No confirmation from a class

Jun 4 2013 1:48 AM
In my previous question regarding the script in class this was extension I am creating a Yes/No confirm here I need to execute the code written in a function when user clicks on Yes

protected void btnclick(object sender,Eventargs e)
{
     // Here my class with Yes/No script will be called based on the condition, after user select Yes I need to execute my code
}

My script in a class file

StringBuilder strScript = new StringBuilder();
strScript.Append("<script type=\"text/javascript\" src=\"").Append("Scripts/jquery-1.4.1.js").Append("\"></script>");
strScript.Append("<script type=\"text/javascript\" src=\"").Append("Scripts/jquery.msgBox.js").Append("\"></script>");
strScript.Append("<link rel=\"stylesheet\" type=\"text/css\" href=\"").Append("CSS/msgBoxLight.css").Append("\" />");
strScript.Append("<script type=\"text/javascript\">");
strScript.Append("(function example()");
strScript.Append("{");
strScript.Append("$.msgBox({");
strScript.Append("title:'Are You Sure'");
strScript.Append(",");
strScript.Append("content:'Would you like a cup of cofee?'");
strScript.Append(",");
strScript.Append("type:'confirm'");
strScript.Append(",");
strScript.Append("buttons:[{value:'Yes'},{value:'No'}]");
strScript.Append(",");
strScript.Append("success:function(result){");
strScript.Append("if(result=='Yes')");
strScript.Append("{");
strScript.Append("alert('One cup of coffee coming right up!')"); // Here Instead of alert I need to pass a value to form something like true or false
strScript.Append("}");
strScript.Append("}");
strScript.Append("});");
strScript.Append("})();");
strScript.Append("</script>");

Can some one help me.

Answers (3)