FileUpload control not working inside Bootstrap Model Popup

Last Reply 2 hours ago By dharmendr

Posted 8 days ago

Hello, a while ago I asked a question https://www.aspforums.net/Threads/487427/Solved-FileUpload-control-not-working-inside-Bootstrap-Model-Popup

The problem is that clicking on the "Save" button closes the window.

How to prevent the window from closing.

I have the "FileUpload" control inside "UpdatePanel".

<div id="myModal" class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-content modal-lg">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
            <h3>Detail</h3>
        </div>
        <asp:UpdatePanel ID="upmisticket" runat="server">
            <ContentTemplate>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="form-group">
  
                                <asp:FileUpload ID="idFileUpload" runat="server" />
  
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <asp:Button ID="btnSubmit" runat="server" Text="Save" OnClick="btnSubmit_Click" />
                    <button class="btn btn-info" data-dismiss="modal" aria-hidden="true">Close</button>
                </div>
            </ContentTemplate>
            <Triggers>
                <%-- <asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />--%>
                <asp:PostBackTrigger ControlID="btnSubmit" />
  
            </Triggers>
        </asp:UpdatePanel>
    </div>
</div>

 

        protected void grvResult_OnRowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("cncDetail"))
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
  
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#myModal').modal('show');");
                sb.Append(@"</script>");
  
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "MyModal", sb.ToString(), false);
            }
        }

With "asp:AsyncPostBackTrigger"  the popup does not close but does not allow uploading the file.

And with "asp:PostBackTrigger" It allows to upload the file but popup closes.

Thanks!

You are viewing reply posted by: Herlan 7 days ago.
Posted 7 days ago

Thanks for answering. I share my code, I have the "FileUpload" control inside "UpdatePanel".

<div id="myModal" class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-content modal-lg">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
            <h3>Detail</h3>
        </div>
        <asp:UpdatePanel ID="upmisticket" runat="server">
            <ContentTemplate>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="form-group">
 
                                <asp:FileUpload ID="idFileUpload" runat="server" />
 
                            </div>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <asp:Button ID="btnSubmit" runat="server" Text="Save" OnClick="btnSubmit_Click" />
                    <button class="btn btn-info" data-dismiss="modal" aria-hidden="true">Close</button>
                </div>
            </ContentTemplate>
            <Triggers>
                <%-- <asp:AsyncPostBackTrigger ControlID="btnSubmit" EventName="Click" />--%>
                <asp:PostBackTrigger ControlID="btnSubmit" />
 
            </Triggers>
        </asp:UpdatePanel>
    </div>
</div>

 

protected void grvResult_OnRowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("cncDetail"))
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
 
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#myModal').modal('show');");
                sb.Append(@"</script>");
 
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "MyModal", sb.ToString(), false);
            }
        }

With "asp:AsyncPostBackTrigger"  the popup does not close but does not allow uploading the file.

And with "asp:PostBackTrigger" It allows to upload the file but popup closes.

Thanks!

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html