473,387 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Validation control problem

106 100+
Hi

I have a registration page. I attached required field validator controls to different controls. when someone visit the page for registration and then want's not to register or view some other page before registration and click on any other link.
it says following field are required. (Which i want only on submit button click)

Any Help in this issue
Jul 11 '08 #1
3 827
kunal pawar
297 100+
Make sure that CausesValidation property is false
ur link control is server control and before redirect it check for validation.
So please check property
CausesValidation=false
Jul 11 '08 #2
Frinavale
9,735 Expert Mod 8TB
If you set the “CausesValidation” property to false, it will disable validation all together on the button.


Check out the "ValidationGroup" property. It allows you to group controls together to allow for a more granular validation behaviour.

Just add the ValidationGroup property to the controls that you want to group together and then add the same ValidationGroup to the control that should execute the validation on postback.

EG
Expand|Select|Wrap|Line Numbers
  1.    <asp:textbox id=“TextBoxA" runat=“server”/>
  2.       <asp:requiredfieldvalidator ValidationGroup=“Group1” ErrorText=“Need to Fill in Value!”  ControlToValidate=“TextBoxA” runat=“server”/>
  3.  
  4.     <asp:textbox id=“TextBoxB" runat=“server”/>
  5.           <asp:requiredfieldvalidator ValidationGroup=“Group1” ErrorText=“Need to Fill in Value!” ControlToValidate=“TextBoxB” runat=“server”/>   
  6.  
  7.     <asp:textbox id=“TextBox1” runat=“server”/>
  8.             <asp:requiredfieldvalidator ValidationGroup=“Group2” ErrorText=“Need to Fill in Value!” ControlToValidate=“TextBox1” runat=“server”/>
  9.  
  10.             <asp:textbox id=“TextBox2” runat=“server”/>
  11.             <asp:requiredfieldvalidator ValidationGroup=“Group2” ErrorText=“Need to Fill in Value!” ControlToValidate=“TextBox2” runat=“server”/>
  12.  
  13.             <asp:button text=“Group1” ValidationGroup=“Group1” runat=“server” ID="FirstButton"/>
  14.             <asp:button text=“Group2” ValidationGroup=“Group2” runat=“server” ID="SecondButton"/>
  15.  
The above code will execute validation for Group 1 (which validates TextBoxA and TextBoxB) when the first button is clicked, and will execute validation for Group 2 (which validates Textbox1 and Textbox2) when the second button is clicked.


Cheers!

-Frinny
Jul 11 '08 #3
Hamayun Khan
106 100+
Thanks to All for helping
Jul 14 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Matt | last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or Client-Side form validation? Since I think each validator control can select either 1) JavaScript based error dialog or 2)...
3
by: Ben | last post by:
Hi, I have a page with a datagrid that you have to scroll to see. I'm using the StrengthControls SmartScroller as recommended to maintain my scroll position. Anyway, inside the datagrid I have...
2
by: Martyn Fewtrell | last post by:
Dear All I have a Windows 2003 Server with IIS6 where the validation controls on ASP.Net pages no longer work. I believe it to be specific to the server as if I create an ASP.Net page on the...
5
by: Chris | last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a datagrid I utilize the footer to create the 'add' row. The only issue is that I have it sharing the 'UpDate_Command' and...
9
by: Bill Long | last post by:
I have a control that simply displays a list of links. Following one of the links doesn't post back or redirect to another page, it simply hides the current panel and shows the one you selected......
5
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design...
2
by: Tim Frawley | last post by:
Source code attached indicates my problem with validation and a button bar save button. Fill the Textbox with some text then tab off the control. The message box will display the text in the...
4
by: Lloyd Dupont | last post by:
I am writing a 'blog control' which, amongst other things, let you edit some HTML text. When it's submited back there are validation problem and to my... *Horrible Disbelief* it seems I can only...
1
by: Buddy Ackerman | last post by:
I don't know what the problem is. I have a form with several controls that need to be validated, I put a validation group in every form control, every validatoino control, the submit button and...
2
by: dustbort | last post by:
I recently had a problem where my required field validator stopped working. But, the page still posted back and tried to insert a record into the database without performing server-side validation....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.