Skip to content

Can't open modals from code behind #31

Open
@gabryk91

Description

@gabryk91

I saw this is a common problem, I am used to open them from codebehind using an hidden button and a small piece of jscript, like this:

<button type="button" style="display: none;" id="btnModal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#modalRegole">Launch demo modal</button>

<script type="text/javascript">
        function ShowModal() {
            $("#btnModal").click();
        }
    </script>

and this code behind call: ClientScript.RegisterStartupScript(Me.GetType(), "alert", "ShowModal();", True)

This works on all my other bootstrap project except the one where i'm using sb admin template.
I need to edit what the modal will show by changing its components texts and visibility and I don't know how to do this without using code behind. So I don't want to open them using attributes data-toggle and data-target.

Any help? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions