• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 616
  • Last Modified:

populate validationsummary manually

Hi all,
Is it possible to manually add a line of text to a validation summary control? Something like a listbox maybe where you can dynamically add to it?

Heres the situation if you want more info:
I have a simple form with 2 textboxes and a series of radioboxes. I have the radioboxes linked together using group name.
I dont use a radioButtonList as I want them to enter additonal information for one of the radio buttons when they select it.
The problem is I cannot use a standard required field validtor of this group of radio buttons like I would with a normal radio button list.
So when they click the submit button I currently have to make my own error message appear separately but the validation summary also appears if the user hasnt filled in other fields.

any advice?
Dave

0
CoreSupport
Asked:
CoreSupport
1 Solution
 
ethothsCommented:
Try a custom validator.
0
 
CoreSupportAuthor Commented:
Nice one:

    protected void CheckSelected(Object sender, ServerValidateEventArgs args)
    {
        if ((FromMyAddress.Checked == true) || (FromCompanyAddress.Checked))
        {
            args.IsValid = true;
        }
        else
        {
            args.IsValid = false;
        }
    }

                    <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Please select a from option."
                        OnServerValidate="CheckSelected">*</asp:CustomValidator>
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now