<h3 id=myModalLabel">上传图片</h3></div><div 类=模态体"><div 类=行流体"style="padding-left: 10px;padding-right: 10px;padding-bottom: 20px;">
解决方案
您可以像在示例中一样使用 ASP 按钮
<div class="modal-footer"><button data-dismiss="modal" class="btn btn-large">关闭</按钮><asp:Button runat="server" ID="btnSaveImage" Text="Save Image" CssClass="Greengradiant btn- large" OnClick="btnSaveImage_Click"/></div>
只需尝试 UseSubmitBehavior="false" 就像所说的 skhurams 并将其与 data-dismiss="modal" 结合使用
<div class="modal-footer"><button data-dismiss="modal" class="btn btn-large">关闭</按钮><asp:Button runat="server" ID="btnSaveImage" Text="Save Image" CssClass="Greengradiant btn- large" OnClick="btnSaveImage_Click" UseSubmitBehavior="false" data-dismiss="modal"/></div>
这将关闭模态并触发回发
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 and the form tag is in it.
Here is my code:
<a href="#dvUpload" data-toggle="modal">
<asp:Button runat="server" ID="lnkUploadPics" CssClass=" btn-large Greengradiant"
Width="100%" Text="Upload pictures"></asp:Button>
</a>
<div id="dvUpload" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×</button>
<h3 id="myModalLabel">
Upload Image</h3>
</div>
<div class="modal-body">
<div class="row-fluid" style="padding-left: 10px; padding-right: 10px; padding-bottom: 20px;">
<div id="Upload" class="span6">
<asp:FileUpload ID="fuImage" runat="server" />
<img id="imgUPload" runat="server" src="" />
</div>
</div>
</div>
<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>
</div>
解决方案
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
这篇关于引导模式内的 ASP.NET 按钮未触发单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!