Solved

Trouble with validation controls

Posted on 2004-08-13
6
190 Views
Last Modified: 2010-04-07
Hi everyone.
I have created a page where the user can add elements to a checkboxlist with typing some text in a textbox and push the 'add' button

                                                <asp:TextBox id="txtKartlegging" runat="server"></asp:TextBox>
                                                <asp:Button class="butt2" id="cmdLeggTil" onclick="cmdLeggTil_Click" runat="server" text="Legg Til"></asp:Button>
                                                <asp:RequiredFieldValidator id="valKartlegging" runat="server" Display="dynamic" ErrorMessage="* Tom Verdi" ControlToValidate="txtKartlegging">* Tom verdi
                                                </asp:RequiredFieldValidator>

Sub cmdLeggTil_Click(sender As Object, e As EventArgs)
if valKartlegging.isValid() then
.......adds the element to the checkboxlist here
end if
End Sub

This works perfect!
But this page is a part of multiple pages in a wizard, and the problem occurs when the user tries to click the 'Next' button which redirects the user to the next page. This button has no validation at all, but still I don't get redirected until the validation on the textbox is valid. Why is it so? How can I just get redirected to the next page without having the textbox validation ok?

the redirecting code looks like this:

<asp:Button class="ButtonOrangeStandard" id="ApplyAndNext" onclick="ApplyAndNext_Click" runat="server" Text="Neste"></asp:Button>

vb:

Sub ApplyAndNext_Click(sender As Object, e As EventArgs)
    Response.Redirect("WebForm8.aspx")
End Sub



0
Comment
Question by:Darth_helge
  • 3
  • 3
6 Comments
 
LVL 28

Expert Comment

by:mmarinov
ID: 11791026
Hi,
you have to add the CauseValidation=False to the ApplyAndNext

Regards,
B..M
0
 
LVL 5

Author Comment

by:Darth_helge
ID: 11791061
like this?:
 <asp:Button class="ButtonOrangeStandard" id="ApplyAndNext" onclick="ApplyAndNext_Click" runat="server" Text="Neste" CauseValidation="False"></asp:Button>

that didn't work
0
 
LVL 28

Expert Comment

by:mmarinov
ID: 11791125
this is the way of skiping validation!
what happend after you use CauseVlidation=false ?

Regards,
B..M
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Author Comment

by:Darth_helge
ID: 11791158
Well, I push the ApplyAndNext button and nothing happens...
If i write something in the textbox and pushes the ApplyAndNext button it works!

This is weird because the only validation check i have in the code is in the cmdLeggtil_Click method which adds an element to the checkboxlist:

Sub cmdLeggTil_Click(sender As Object, e As EventArgs)
if valKartlegging.isValid() then
.......adds the element to the checkboxlist here
end if
End Sub

Here is my <page> tag:

<%@ Page Explicit="True" Language="VB" Debug="True" AspCompat="True" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
0
 
LVL 28

Accepted Solution

by:
mmarinov earned 500 total points
ID: 11791165
i think it is related with the type of validation
by default the EnableCLientScript is set to through and the validation is performed on the client every time
try to set it to false and check if there is some change

Regards,
B..M
0
 
LVL 5

Author Comment

by:Darth_helge
ID: 11791195
IT worked!
Thanks a million!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now