473,748 Members | 3,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validation Group

Hello,

I have a button that is associated with a validation group. When I click
the button and a validation fails, I still want to code to execute. Can
this be done? Any help with this would be appreciate.

Thanks in advance, Sck10

In my code behind:
Sub Submit_Click(By Val Sender As Object, ByVal Args As EventArgs)
lblRegisterMsg. Text = "<hr />Page.IsValid :" & Page.IsValid.To String() &
"<br />"
End Sub
Snippet of content page:

<!-- Test Validation Stuff -->
<asp:Label id="lblRegister Msg" runat="server" />
<asp:Validation Summary
ValidationGroup ="vgDocUploa d"
id="valSummaryM essage"
HeaderText="<hr />The following errors were found:"
runat="server" />
<tr>
<td width="100"><di v align="right">S ubmitter:</div></td>
<td width="500"><di v align="left">
<asp:textbox id="txtSubmitte r" Runat="server"/>
<asp:RequiredFi eldValidator ID="rfvSubmitte r"
ValidationGroup ="vgDocUploa d"
ControlToValida te="txtSubmitte r"
ErrorMessage="Y our name is missing."
Text="*"
Runat="server" />
</div></td>
</tr>

<tr>
<td width="100"><di v align="right">S elect File:</div></td>
<td width="500"><di v align="left">
<asp:Button ID="btnUpload"
ValidationGroup ="vgDocUploa d"
Text="Upload"
OnClick="Submit _Click"
Runat="server"/>
</div></td>
</tr>
Nov 18 '05 #1
1 3025
Hi Sck10,

From your description, you're using the Validation Controls on a webform to
validate some entry fields. And when we push a submit button, the validtion
will occur which prevent the form be posted back, so you're wondering how
to make the post back still occur when there is validation error , yes?

Based on my understanding, this problem is caused by the validation
controls' clientside validtion which will prevent the form from being
submit. If you still want the form be posted back( and button's event
handler be executed), we can choose either of the following means:
1. Turn off the validation control's EnableClientScr ipt propety (set to
false) , then the client validation won't take place. But still let the
submit button as "CauseValidatio n" = true ( this is the default settting).
Thus, when we push the submit button, the form will be posted back to
serverside and validtion is done before button's postback eventhandler
(after Page_Load).

2. Set the Submit's CauseValidation to "false" , then the validation won't
take place automaticaly when we hit the submit button. But we can manually
call the Page.Validate() in the Page_Load method to manually make the page
to validating all the controls which is attached with a validtor. Also in
the Button's Click Event , the Page.IsValid is accessable after the
validtion.

And here is a tech article discussing on the underlying detail of ASP.NET's
validation (client and serverside):

#ASP.NET Validation in Depth
http://msdn.microsoft.com/library/en...id.asp?frame=t
rue#aspplusvali d_serverside

Hope also helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
8294
by: Phil Powell | last post by:
Where can I find an online PHP form validator script library to use? I have tried hacking the one here at work for weeks now and it's getting more and more impossible to customize, especially now with form elements that turn out to be arrays that have to be compared with one another! I have one form element, languages, a checkbox group. Beside each checkbox is a dropdown, proficiency (which will become proficiency alongside languages)....
21
6252
by: AnnMarie | last post by:
<script language="JavaScript" type="text/javascript"> <!-- function validate(theForm) { var validity = true; // assume valid if(frmComments.name.value=='' && validity == true) { alert('Your full name is required. Please enter your full name!'); validity = false; frmComments.name.focus();
0
1133
by: George Jordanov Ivanov | last post by:
Hi there, I have a problem related with validation of a container control, containing other container controls. Scenario: I have a dialog based Windows form, containing a group control (which is a container also). The group control contains multiple other simple controls - 2 text boxes and 3 combo boxes. The form has 2 buttons representing the well-known OK and Cancel buttons. What I am trying to do: I handle Validating event for all...
3
1528
by: VB Programmer | last post by:
Can you make a required field validator optional? I know it sounds crazy, but.... Let's say I have a signup form. It consists of 2 sections. The top section is a "GOLD MEMBER" section. It has required validators for name, address, etc... The next section is the "BRONZE MEMBER" section. It also has required validators for the same fields. The user only has to fill out 1 set of info. Any thoughts on how to accomplish this?
1
1386
by: Shaker | last post by:
For simplicity, I have on one form: -textbox1/Requiere For validation1 / submitbuttun1, -textbox2/Requiere For validation2 / submitbuttun2, I have two submit buttons on an ASP.Net page with two textboxes and two require for validation controls per textbox. In summary I want to group the fields on the page per submit action, and not on any action.
1
2384
by: Kris | last post by:
Hi, I have a DataGrid where in each row has couple of text boxes and an update button. Each row is dynamically generated as the number of rows are not known ahead of time. When the user clicks the update button, I do a postback to capture the data entered. However I dont want to do a postback when the textboxes are empty. How do I prevent this using Clientside validation? This is a common problem and if it has been beaten to death, please...
5
1907
by: Lloyd Dupont | last post by:
On my page the user is ask to set of question. Say there I have 2 controls like that == pseudo-C#-code for my control == class MyControl : CompositeControl { TextBox text; LinkButton button override void CreateChildControl() {
1
1839
by: Rajani | last post by:
Hi, I have designed a form which process database Insert, edit and Delete(datagrid). I input userid,password and privilege in textboxes which has validation controls to verify data keyed in. And press the button to perform insert operation. Upto here is fine. I want to perform edit or delete operations. I put datagrid for that one.
2
452
by: moondaddy | last post by:
How can I have a page with 2 different groups of controls (where each group of controls contain textboxes, validation controls and a submit button) and each group operate independently? for example, when the user clicks on the first submit button, it wont submit unless all the controls in group 1 are valid, likewise, when the user clicks on the 2nd submit button, it wont submit unless all the controls in group 2 are valid. thanks.
1
2654
by: Fendi Baba | last post by:
I wrote a simple validation routine. I am trying to trigger validation on group of fields if an option on another radio button is selected. Sub ValidateAdd_ServerValidate(ByVal objSource As Object, ByVal objArgs As ServerValidateEventArgs) if radioDbutton.SelectedItem.Value="yes" Then
0
8828
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9537
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9243
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8241
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.