The following code displays a warninng via MvcHtmlString.
in C#
public static MvcHtmlString ShowAlert(this HtmlHelper helper, string message)
{
StringBuilder sb = new StringBuilder();
sb.Append(@"$.confirm({" +
"title: false," +
"content: '" + message + "'," +
"type: 'dark'," +
"boxWidth: '45%'," +
"animation: 'RotateY',closeAnimation: 'RotateY',rtl: true," +
"typeAnimated: true," +
"buttons:" +
"{Close: {" +
"btnClass: 'btn-blue'} }});");
return MvcHtmlString.Create(sb.ToString());
}
in Script
<script type="text/javascript">
$('#bSubmit').click(event,
function() {
event.preventDefault();
@Html.ShowAlert("Test");
});
</script>
I want to display an Alert in MvcHtmlString which is Yes/No
and returns the clicked buttons so I can use the value in the script.