Hi
I have below Modal. When there is error in Code behind Modal goes off. It should remain on Modal Popup Screen
<div id="modal_form_horizontal" class="modal fade"> <div class="modal-dialog modal-dialog-centered"> <div class="modal-content"> <div class="modal-header bg-info"> <h5 class="modal-title">Add/Update Employee Category</h5> <button type="button" class="close" data-dismiss="modal">×</button> </div> <div class="form-horizontal"> <div class="modal-body"> <div class="row"> <div class="col-lg-6"> <div class="form-group"> <label>Employee Category</label> <span style="color: red">*</span> <asp:TextBox ID="txtDescription" MinLength="3" MaxLength="50" class="form-control alpha" required="true" runat="server" Text='<%# Eval("description") %>'></asp:TextBox> </div> </div> <div class="col-lg-4"> <div class="form-group"> <label>Status</label> <asp:DropDownList ID="ddlStatus" class="form-control select-search" runat="server"> <asp:ListItem Value="True">Active</asp:ListItem> <asp:ListItem Value="False">Blocked</asp:ListItem> </asp:DropDownList> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-link" data-dismiss="modal">Close</button> <asp:Button ID="lnkEmpCategory" runat="server" class="btn bg-primary" OnClick="btnAdd_Click" Text="Save" /> </div> </div> </div> </div> </div>
protected void btnAdd_Click(object sender, EventArgs e) { string errMessage = ""; if (String.IsNullOrWhiteSpace(txtDescription.Text)) { errMessage += "Description is required and cannot Be empty.</br>"; } Boolean IsValidDescription = Common.CommonFunction.IsAlpha(txtDescription.Text); if (IsValidDescription == false) { errMessage += "Description : Only Alphabets , Space , _ - allowed.</br>"; } }
Thanks