Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6665479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:43:40+00:00 2026-05-26T02:43:40+00:00

So here is the issue. I have a DropDownList in a .ascx control with

  • 0

So here is the issue. I have a DropDownList in a .ascx control with a CustomValidator on it. This control has a ValidationGroup set by a property in the PageLoad. The button that triggers the validation is in a another file that uses this control. The problem is that the server side validation is never getting fired. I add breakpoints in it and they are never hit. Anyone have any thoughts about what is going on? Here is the code:

Dropdown.ascx:

    <asp:DropDownList ID="ddlQuestions" runat="server">
    </asp:DropDownList>
    <asp:CustomValidator runat="server" ID="cvddlQuestions" OnServerValidate="cvddlQuestions_ServerValidate"
         ErrorMessage="* Parent question is required." ValidateEmptyText="true" Display="Dynamic" />
    </p>
</div>

Code behind:

protected void Page_Load(object sender, EventArgs e)
{
    cvddlQuestions.ValidationGroup = ValidationGroup; 
    //ValidationGroup is a property in the parent file that is being set on PageLoad
}

protected void cvddlQuestions_ServerValidate(object sender, ServerValidateEventArgs args)
{
    args.IsValid = false;// (ddlQuestions.SelectedValue != "-1");
}

In the parent file that uses Dropdown.ascx I have this button:

<asp:LinkButton ID="btnQuestionAdd" runat="server" OnClick="btnQuestionAdd_Click" 
    ValidationGroup="editQuestion" CommandName="add" />

Parent files code behind:

protected void btnQuestionAdd_Click(object sender, EventArgs e)
{
    Page.Validate("editQuestion");
    if (Page.IsValid)   //ALWAYS SEEMS TO BE TRUE
    {
        //Do something
    }
}

When I add a client validation function to the customvalidator it fires no problem. But the page is ALWAYS returning as valid. I have tried adding a ControlToValidate and setting ValidateEmptyText=”true” and I still get the same result. What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:43:40+00:00Added an answer on May 26, 2026 at 2:43 am

    It turns out that the answer was something incredibly stupid. When I instantiated the control that all this code was within I had to set the ValidationGroup property on the front end rather than the back end.

    Lets say the code I posted was within a .ascx file called QuestionControl.ascx. After registering the control on my page I had to write the following:

    <asp:QuestionControl runat="server" id="qcPage" ValidationGroup="editQuestion" />
    

    No idea why saying:

    qcPage.ValidationGroup = "editQuestion";
    

    didn’t work since the property was only a string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a a generic control called dropdownlist.ascx that populates it's ListItems based on
Here's the issue: I have a hook in IE that reacts on WebBrowser.OnNavigateComplete2 event
Here's the issue: I have 2 data contexts that I would like to do
Here's the issue: I have a list of App names that I want to
Having an issue here that I have tried everything I can think of but
Here is the issue I am having: I have a large query that needs
I am having an issue here i have a list this.Ddown having 3 properties
I have small page which has label, DropDownList and a submit button. <div> <asp:label
i have done drag and drop using with jquery. here i have issue that
Here's the issue: I have a JS dropdown for country and state that runs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.