I have this JavaScript code in an ASPX page
<script>
function show_modal(statut)
{
if (statut == true)
{
$(function ()
{
$('#modal_success').modal('show')
})
}
else
{
$(function ()
{
$('#modal_fail').modal('show')
})
}
}
</script>
That shows an modalpopup which I like to launch from my code behind.
I tried this, but it didn’t work:
if (resultat)
{
ClientScript.RegisterStartupScript(this.GetType(), "", "show_modal(true);");
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "", "show_modal(false);");
}
but I can’t figure out why!
This call requires you to wrap the call in a
<script>tag (or use the other overload which allows you to specify if script tags are added)or