Home
Tool
Json Beautify
Find Web URL
Inventory Management System
Test Mantra RD Service
Calculate your EMI
Project
Inventory Management System
Task Management
Project Management
Mobile Store Management
Money Transfer Tool
Store Management
About Us
Contact
Login
Registration
Search
ASP.net
Validate form using page_clientvalidate in asp.net
By
Csharp Code
Apr 26 2020
1457 View's
0 Comment's
Like (
0
)
Dislike (
0
)
If you want to check your form is validated or not through javascript using page_clientvalidate
Create a .aspx page in paste this HTML
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Remitter Registration :: Remitter Details</h3>
</div>
<div class="box-body">
<div class="col-md-3">
<label for="exampleInputEmail1">
First Name
<asp:RequiredFieldValidator runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Request" ControlToValidate="InputFirstName"></asp:RequiredFieldValidator>
</label>
<asp:TextBox ID="InputFirstName" class="form-control" runat="server" placeholder="First Name" ValidationGroup="Request" AutoCompleteType="Disabled"></asp:TextBox>
</div>
<div class="col-md-3">
<label for="exampleInputEmail1">
Last Name
<asp:RequiredFieldValidator runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Request" ControlToValidate="InputLastName"></asp:RequiredFieldValidator>
</label>
<asp:TextBox ID="InputLastName" class="form-control" runat="server" placeholder="Last Name" ValidationGroup="Request" AutoCompleteType="Disabled"></asp:TextBox>
</div>
<div class="col-md-3">
<label for="exampleInputEmail1">
Mobile
<asp:RequiredFieldValidator runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Request" ControlToValidate="InputMobile"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator runat="server" ForeColor="Red" ValidationGroup="Request" ControlToValidate="InputMobile" ErrorMessage="Invalid mobile no" ValidationExpression="[0-9]{10}"></asp:RegularExpressionValidator>
</label>
<asp:TextBox ID="InputMobile" class="form-control" runat="server" placeholder="Remitter mobile" ValidationGroup="Request" MaxLength="10" MinLength="10" AutoCompleteType="Disabled"></asp:TextBox>
</div>
<div class="col-md-3">
<label for="exampleInputEmail1">
Pincode
<asp:RequiredFieldValidator runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Request" ControlToValidate="InputPinCode"></asp:RequiredFieldValidator>
</label>
<asp:TextBox ID="InputPinCode" class="form-control" runat="server" placeholder="Remitter Pincode" ValidationGroup="Request" AutoCompleteType="Disabled"></asp:TextBox>
</div>
<div class="col-md-3">
<label for="exampleInputEmail1">
Address
<asp:RequiredFieldValidator Enabled="false" runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Request" ControlToValidate="InputAddress"></asp:RequiredFieldValidator>
</label>
<asp:TextBox ID="InputAddress" class="form-control" runat="server" placeholder="Remitter Address" ValidationGroup="Request" Rows="1" TextMode="SingleLine" AutoCompleteType="Disabled"></asp:TextBox>
</div>
<div class="col-md-3">
<label for="exampleInputEmail1">
City
<asp:RequiredFieldValidator Enabled="false" runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Request" ControlToValidate="InputCity"></asp:RequiredFieldValidator>
</label>
<asp:TextBox ID="InputCity" class="form-control" runat="server" placeholder="Remitter city" ValidationGroup="Request" AutoCompleteType="Disabled"></asp:TextBox>
</div>
<div class="col-md-3">
<label for="exampleInputEmail1">
State
<asp:RequiredFieldValidator Enabled="false" runat="server" ErrorMessage="*" ForeColor="Red" ValidationGroup="Request" ControlToValidate="InputState"></asp:RequiredFieldValidator>
</label>
<asp:TextBox ID="InputState" class="form-control" runat="server" placeholder="Remitter state" ValidationGroup="Request" AutoCompleteType="Disabled"></asp:TextBox>
</div>
</div>
<div class="box-footer">
<div class="col-md-12">
<asp:LinkButton runat="server" class="btn btn-primary btn-social btn-sm" OnClientClick="return
RetailerRemitterValidation()
;" ValidationGroup="Request"><i class="fa fa-save"></i>Submit</asp:LinkButton>
<asp:LinkButton runat="server" class="btn btn-danger btn-social btn-sm" PostBackUrl='javascript:history.back()'><i class="fa fa-undo"></i>Back</asp:LinkButton>
</div>
</div>
</div>
</div>
After added HTML, add this javascript,
it will check your form is validate or not, or you can do - show popup after validation on client-side. it will resolve many problems
<script>
function
RetailerRemitterValidation
() {
if (Page_ClientValidate('Request')) {
return true;
}
return false;
}
</script>
0 Comment's
Comment Form
Required
Submit Comment
Csharp Code
If opportunity doesn’t knock, build a door.⛩
Popular Post
WPF
How to Use Logger in WPF Application
By
Csharp Code
Jun 07 2022
C-Sharp
Update Specific Users Out of Oce Settings C# with Example
By
Csharp Code
Jun 06 2022
C-Sharp
Retrieve Specified User''s Out of O ce Settings C# with Example
By
Csharp Code
Jun 06 2022
C-Sharp
Large Object Heap compaction C# with Example
By
Csharp Code
Jun 06 2022
C-Sharp
Weak References C# with Example
By
Csharp Code
Jun 06 2022
C-Sharp
Source code in the view C# with Example
By
Csharp Code
Jun 06 2022
Notifications