Reputation: 54183
I have a boostrap modal, and here is the button to close it:
<div class="modal-footer">
<asp:Button ID="btnClose" CssClass="btn" runat="server" Text="Close" data-dismiss="modal" aria-hidden="true" />
</div>
The Button and modal form are nested in an update panel. But it does not trigger a postback so the update panel does not do its thing. If I remove data dismiss then it will not close the modal.
What could I do?
Upvotes: 2
Views: 5902
Reputation: 586
You can use the ASP Button like in your example
<div class="modal-footer">
<asp:Button ID="btnClose" CssClass="btn" runat="server" Text="Close" data-dismiss="modal" aria-hidden="true" />
</div>
just try the UseSubmitBehavior="false"
<div class="modal-footer">
<asp:Button ID="btnClose" CssClass="btn" runat="server" Text="Close" data-dismiss="modal" aria-hidden="true" UseSubmitBehavior="false" />
</div>
this will close the modal and trigger a postback
Upvotes: 8
Reputation: 3121
Data-dismiss is javascript based and just hides the modal. If you want the close button to postback, you'll need to use the OnClick property and add a method to handle that in your code-behind:
<asp:Button ID="btnClose" CssClass="btn" runat="server" Text="Close" data-dismiss="modal" aria-hidden="true" OnClick="YourMethodNameGoesHere"/>
Then in your code-behind...do something:
protected void YourMethodNameGoesHere()
{
// Do stuff
}
Upvotes: 2