How to display a modal using the c# and bootstrap button?

Asked

Viewed 1,568 times

0

If you use the <button type="button" data-toggle="modal" data-target="#ConvenioOk">Teste </button> modal opens. But I have to use the C# button due to the event. The button calling the modal is like this<asp:Button ID="btnCadastrarCon" runat="server" data-togggle="modal" data-target="#ConvenioOk" Text="Cadastrar" OnClick="btnCadastrarCon_Click" />

Is there any way to use modal with the Asp button, even without using bootstrap? If yes, you can give examples?

2 answers

1


You can display your modal from the backend using the ScriptManager:

ScriptManager.RegisterStartupScript(this, GetType(), "LaunchServerSide", "$(function() { funcaoQueExibeModal(); });", true);

On your aspx:

function funcaoQueExibeModal() {
            $('#minhaModal').modal();
        }

0

certainly, however you will have to build your own modal. That is, intercept the click on the browser, create Javascript / CSS to display the modal. In my opinion it gives more work, but follows an example:

https://stackoverflow.com/a/27603898/1384539

Browser other questions tagged

You are not signed in. Login or sign up in order to post.