[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Validation control and LinkButton control problem

Posted on 2006-06-30
1
Medium Priority
?
479 Views
Last Modified: 2011-10-03
I have Validation control that validates user input on TextBox control.
Also there is LinkButton on my form with OnClick event handler defined.

Now when LinkButton is clicked and Validation condition is not met then OnClick handler of LinkButton is not invoked.

Why is this happening?
How does the Validation ctrl. suppreses OnClick event of LinkButton ctrl?

When Validation condition on TextBox is OK then all works as expected.

Here is page to illustrate this:

<%@ Page Language="C#" %>
<script Language="C#" runat="server">

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        int x = 1;
    }

</script>
<html >
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
            ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
        <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click">LinkButton</asp:LinkButton></div>
    </form>
</body>
</html>

This code does not do anything smart, it is just for testing.
Try putting breakpoint on line "int x = 1;" to see this behavior.
0
Comment
Question by:sinisap
[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
1 Comment
 
LVL 9

Accepted Solution

by:
zaghaghi earned 500 total points
ID: 17018133
you can set the CauseValidation of tyhe link button to False
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

656 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