| |

VerySource

 Forgot password?
 Register
Search
View: 638|Reply: 1

Questions about validatorGroup

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 Invalid IP Address

Post time: 2020-2-17 15:00:01
| Show all posts |Read mode
<form id = "form1" runat = "server">
        <asp: ValidationSummary ID = "valSum" runat = "server"
        DisplayMode = "List"
        Font-Name = "verdana"
        Font-Size = "12" EnableClientScript = "False" ValidationGroup = "gp1"
        />
        <br />
        <asp: TextBox ID = "TextBox1" runat = "server" ValidationGroup = "gp1"> </ asp: TextBox> <asp: RequiredFieldValidator
            ID = "RequiredFieldValidator1"
            runat = "server"
            ErrorMessage = "error1"
            Display = "Dynamic"
            Font-Size = "12"
            ControlToValidate = "TextBox1" EnableClientScript = "False" ValidationGroup = "gp1"> *
        </ asp: RequiredFieldValidator>
        <br />
        <asp: TextBox ID = "TextBox2" runat = "server" ValidationGroup = "gp1"> </ asp: TextBox> <asp: RequiredFieldValidator ID = "RequiredFieldValidator2" runat = "server" ControlToValidate = "TextBox2"
            ErrorMessage = "error2" EnableClientScript = "False" ValidationGroup = "gp1"> * </ asp: RequiredFieldValidator>
        <br />
        <br /> <asp: Button ID = "Button1" runat = "server" Text = "Button" ValidationGroup = "gp1" CausesValidation = "False" /> <br />
        <br />
        <asp: ValidationSummary ID = "ValidationSummary1" runat = "server"
        DisplayMode = "List"
        Font-Name = "verdana"
        Font-Size = "12" EnableClientScript = "False" ValidationGroup = "gp2"
        />
        <br />
        <asp: TextBox ID = "TextBox3" runat = "server" ValidationGroup = "gp2"> </ asp: TextBox> <asp: RequiredFieldValidator ID = "RequiredFieldValidator3" runat = "server" ControlToValidate = "TextBox3"
            Display = "Dynamic" EnableClientScript = "False" ErrorMessage = "error3" Font-Size = "12" ValidationGroup = "gp2"> *
        </ asp: RequiredFieldValidator> <br />
        <br /> <asp: Button ID = "Button2" runat = "server" Text = "Button" ValidationGroup = "gp2" /> <br />
        <br />
        <br />
        &nbsp;
        <asp: Button ID = "Button3" runat = "server" Text = "Button" />
    </ form>

Defined 2 Groups
Now click Button1 to check gp1
Now click Button2 to do gp2 check

I want to do gp1 and gp2 check at the same time
But the message is in a different ValidationSummary
How to achieve it?


Or if I don't distinguish gp and do all checks on the screen at the same time, how can I get the error information of the check on my own in different areas of the screen?
Reply

Use magic Report

0

Threads

43

Posts

29.00

Credits

Newbie

Rank: 1

Credits
29.00

 China

Post time: 2020-4-21 14:00:02
| Show all posts
Just do n’t use ValidationSummary, put the validation of two sets of controls in different areas
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list