locked
Validating Data RRS feed

  • Question

  • User-797751191 posted

    Hi

      I have below code but when i Save it is not Validating Data. 

      

    <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog" style="width: 360px;"> <div class="modal-content"> <div class="modal-header" style="background-color: #337AB7;padding:16px 16px;color:#FFF;border-bottom:2px dashed #337AB7;"> <h4 class="modal-title"></h4> </div> <div class="modal-body"> <asp:TextBox CssClass="form-control" ID="txtRemarks" TextMode="MultiLine" Rows="5" runat="server"></asp:TextBox> <asp:RegularExpressionValidator Display = "Dynamic" ControlToValidate = "txtRemarks" ID="rfv0" ValidationExpression = "^[A-Za-z0-9]{5}$" runat="server" ErrorMessage="Minimum 5 characters required."></asp:RegularExpressionValidator> </div> <div class="modal-footer"> <asp:Button ID="btnReject" OnClick="btnReject_Click" runat="server" Text="Reject" CssClass="btn btn-primary" /> <input type="button" class="btn btn-secondary" data-dismiss="modal" value="Cancel" /> </div> </div> </div> </div>

    Thanks

    Saturday, June 29, 2019 6:05 AM

All replies

  • User288213138 posted

    Hi jsshivalik,

    I tried to reproduce your problem, but I found it worked.What's error in you code?

    This is my code:

    <div class="modal fade" id="myModal" role="dialog">
                <div class="modal-dialog" style="width: 360px;">
                    <div class="modal-content">
                        <div class="modal-header" style="background-color: #337AB7; padding: 16px 16px; color: #FFF; border-bottom: 2px dashed #337AB7;">
                            <h4 class="modal-title"></h4>
                        </div>
                        <div class="modal-body">
                            <asp:TextBox CssClass="form-control" ID="txtRemarks" TextMode="MultiLine" Rows="5" runat="server"></asp:TextBox>
                            <asp:RegularExpressionValidator Display="Dynamic" ControlToValidate="txtRemarks" ID="rfv0" ValidationExpression="^[A-Za-z0-9]{5}$" runat="server" ErrorMessage="Minimum 5 characters required.">
    
                            </asp:RegularExpressionValidator>
                        </div>
                        <div class="modal-footer">               
                            <asp:Button ID="Button1" runat="server" Text="Save" OnClick="Button1_Click" />
                        </div>
                    </div>
                </div>
            </div>
    Aspx.cs:
    protected void Button1_Click(object sender, EventArgs e)
            {         
                Response.Write(txtRemarks.Text);
            }  

    The result:

    If you haven't solved the problem, please post your code behind.

    Best regards,

    Sam

    Monday, July 1, 2019 2:18 AM