在关闭事件后引导模式删除数据。

时间:2022-04-23 11:57:39

I have a listbox in my modal that is not clearing after i close my modal. when i re-open it, the data is still there. :(

我的模态上有一个列表框,在我关闭了模态之后,它就不清除了。当我重新打开它时,数据仍然在那里。:(

Here is my code :

这是我的代码:

Javascript

Javascript

$('#modalCRDDDST_Lookup').on('hidden.bs.modal', function (e) {
                $("#modalCRDDDST_Lookup").remove();
            });

Code for my Modal

代码我模态

<div class="modal fade" id="modalCRDDDST_Lookup" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:800px;margin:5px auto">
        <asp:UpdatePanel ID="upModalCRDDDST_Lookup" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
            <ContentTemplate>
                <div class="modal-content" style="height:650px">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title"><asp:Label ID="Label12" runat="server" Text="CRDDDST - Lookup"></asp:Label></h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <asp:UpdatePanel ID="upCRDDDSTLookup" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                                <Triggers>
                                    <asp:AsyncPostBackTrigger ControlID="btnCRDDDSTLookup_Search" EventName="Click" />
                                </Triggers>
                                <ContentTemplate>
                                    <table class="table">
                                        <tr>
                                            <td class="td col-md-12 bg-primary" style="text-align: center;">
                                                <asp:Label ID="Label18" class="label" runat="server" Text="Results" Font-Size="Large"/>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:ListBox ID="lbCRDDDSTLookup_Results" runat="server" Height="175px" Width="745px" SelectionMode="Multiple" ></asp:ListBox>
                                            </td>
                                        </tr>
                                    </table>
                                </ContentTemplate>
                            </asp:UpdatePanel>

                            <div class="pull-right">
                                <asp:Button ID="btnCRDDDST_Lookup_Accept" runat="server" Text="OK" CssClass="btn btn-primary" OnClick="LookupCRDDDSTSearch" /> 
                                <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
                            </div>
                        </div>
                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
</div>

Please can someone help me how to clear.

请有人帮我清理一下。

Thanks

谢谢

1 个解决方案

#1


0  

Did you try to clear all listbox elements before deleting whole modal?

在删除整个模式之前,是否尝试清除所有的列表框元素?

Possible answer already here: How to clear an ASP.NET listbox with Javascript?

可能的答案已经在这里:如何清除ASP。净和Javascript列表框吗?

#1


0  

Did you try to clear all listbox elements before deleting whole modal?

在删除整个模式之前,是否尝试清除所有的列表框元素?

Possible answer already here: How to clear an ASP.NET listbox with Javascript?

可能的答案已经在这里:如何清除ASP。净和Javascript列表框吗?

相关文章