I\'m working in Bootstrap modal in my asp.net site, modal is working fine but the button btnSaveImage inside modal footer is not firing click event, I also have a masterpage
You can use the ASP Button like in your example
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-large"> Close</button>
<asp:Button runat="server" ID="btnSaveImage" Text="Save Image" CssClass="Greengradiant btn- large" OnClick="btnSaveImage_Click" />
</div>
just try the UseSubmitBehavior="false" like said skhurams and combine it with the data-dismiss="modal"
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-large"> Close</button>
<asp:Button runat="server" ID="btnSaveImage" Text="Save Image" CssClass="Greengradiant btn- large" OnClick="btnSaveImage_Click" UseSubmitBehavior="false" data-dismiss="modal" />
</div>
this will close the modal and trigger the postback
I'd like to add another point here. I faced this issue because my final rendered modal dialogs were placed outside the WebForms <form>
tag, and using the UseSumbitBehavior="false"
did not solve my problem. Moving the modal dialog divs inside the form solved the issue.
$("div.modalForm").appendTo($("form:first"));