Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Trouble with validation controls

Posted on 2004-08-13
6
Medium Priority
?
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

609 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