Hi ramco1917,
Please refer below smaple.
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" />
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script>
<div class="modal-dialog">
<div class="modal-content">
<div id="modal_form_horizontal">
<div class="modal-header bg-info">
<h5 class="modal-title">Add/Update Record</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-3">
<div class="form-group">
<label>Year</label> <span style="color: red">*</span>
<asp:DropDownList ID="ddlYear" class="form-control" runat="server">
<asp:ListItem Value="">Select Year</asp:ListItem>
<asp:ListItem Value="">2012</asp:ListItem>
<asp:ListItem Value="">2013</asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="col-lg-6">
<div class="form-group">
<label>Rating</label>
<asp:TextBox ID="txtRating" class="form-control" numaceholder="Rating" required="true" runat="server"></asp:TextBox>
<asp:Label ID="lblMessage" Text="Please enter 100 only." runat="server" Visible="false" ForeColor="Red" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link" data-dismiss="modal">Close</button>
<asp:Button ID="btnSave" runat="server" class="btn bg-primary" Text="Save" OnClick="Validate" />
</div>
</div>
</div>
</div>
</div>
Code
C#
protected void Validate(object sender, EventArgs e)
{
lblMessage.Visible = false;
if (txtRating.Text != "100")
{
lblMessage.Visible = true;
string message = "The Value shoud be 100... ";
ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('" + message + "');", true);
}
}
VB.Net
Protected Sub Validate(ByVal sender As Object, ByVal e As EventArgs)
lblMessage.Visible = False
If txtRating.Text <> "100" Then
lblMessage.Visible = True
Dim message As String = "The Value shoud be 100... "
ClientScript.RegisterStartupScript(Me.GetType(), "alert", "alert('" & message & "');", True)
End If
End Sub
Screenshot