You must Sign In to post a response.
  • Category: ASP.NET

    Why when I click Dropdown list bootstrap modal is closing

    i am using bootstrap modal and in modal i am using dropdownlist. But When
    i click dropdownlist the modal is going close. i could not complete my
    entry form.

    <asp:UpdatePanel ID="upMain" runat="server" UpdateMode="Conditional">
    <asp:PostBackTrigger ControlID="bSave" />
    <asp:PostBackTrigger ControlID="bNewComment" />
    <asp:PostBackTrigger ControlID="btnShowPopup" />
    <asp:PostBackTrigger ControlID="ddlEditTypeOfLand" />
    <asp:Button ID="btnShowPopup" runat="server" Text="Open Modal" class="btn btn-primary btn-lg" />
    <div id="myModal" class="modal fade" data-backdrop="static" data-keyboard="false"
    <div class="modal-dialog">
    <div class="modal-content">
    <div class="modal-header">
    <h4 class="modal-title">
    <div class="modal-body">
    <div class="row">
    <div class="col-sm-6 form-group">
    <asp:Button ID="bNewComment" CssClass="btn btn-info" Text="Add Comment" runat="server"
    OnClick="bNewComment_Click" OnClientClick="showComment();" />
    <div class="row" id="dComment" runat="server" style="display: none;">
    <div class="col-sm-6 form-group">
    <asp:TextBox ID="tbComment" TextMode="MultiLine" Width="500px" runat="server" placeholder="Enter Comments.."
    <div class="col-sm-5 form-group">
    <b>Type Of Land</b><span style="color: Red; font-weight: bolder; font-size: medium;">*</span>
    <asp:DropDownList ID="ddlEditTypeOfLand" AutoPostBack="true" runat="server" class="form-control"
    <asp:ListItem Value="0" Selected="True"><---Select---></asp:ListItem>
    <asp:ListItem Value="1">Wasted Land</asp:ListItem>
    <div class="modal-footer">
    <asp:Button ID="bClose" runat="server" CssClass="btn btn-primary" data-dismiss="modal"
    Text="Close" />
    <asp:Button ID="bSave" runat="server" CssClass="btn btn-primary" Text="Save" OnClick="bSave_Click" />

    Code behind
    protected void ddlEditTypeOfLand_SelectedIndexChanged(object sender, EventArgs e)
    catch (Exception ex)
    throw ex;
  • #767008

    The problem is "PostBackTriggers" inside UpdatePanel in your design.

    Before work on this issue we should know the difference between PostBackTrigger and AsyncPostBackTrigger and when we use those.

    1. AsyncPostBackTrigger:

    The data will transacted without Full post back, for example if you want to bind data based on dropdown selection in that case we should use this.


    In postbacktrigger, it is full postback where as in AsyncPostBackTrigger it is partial postback, for example if you want to upload file, in that case it should full post back then only file saved in server, if you are using AsyncPostBackTrigger(Partial postback) file won't saved in server.

    Now decide which control you want to use for binding the data based on dropdown selection.

    In your situation you are performing PostBackTriggers (Full PostBack), that is the reason control looses his action/ data.

    Hope you understood...

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #767010

    1. Try placing your bootstrap modal outside update panel and just place dropdown inside it.
    2. Try placing this code:


Sign In to post your comments