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 6149959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:32:33+00:00 2026-05-23T19:32:33+00:00

I have read through this which helped me narrow down my validation problems to

  • 0

I have read through this which helped me narrow down my validation problems to the InitialValue property of the RequiredFieldValidator.

My drop down list is a list of objects which are populated by the code behind like this;

brands.Insert(0, Brand.Empty)

cbBrand.DataValueField = "ID";
cbBrand.DataTextField = "Name";
cbBrand.DataSource = new BindingList<Brand>(brands);
cbBrand.DataBind();

where Brand.Empty is a null object type.

Where I’m coming unstuck is getting the IntialValue to accept a null value. For instance, InitialValue="" fails to recognise the empty object in the list.

Can anyone point me in the direction of a fix for this?

  • 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-23T19:32:34+00:00Added an answer on May 23, 2026 at 7:32 pm

    Wow. I thought I had searched previous answers on this site very thoroughly before posting this question, but I had missed this!!

    The answer is to change your <asp:DropDownList> to have the property AppendDataBoundItems=true, Then add an <asp:ListItem Text="" Value="" /> between the dropDownList tags and BAM! you can insert a value to the list that does not require the null object inserted in the code behind (which should be removed so that you don’t end up with 2 blanks at the start of your list).

    The benefit here is that the list in my code-behind is bound to an object type <Brand>, but adding the empty string at the client works fine for client-side validation.

    Hope this helps anyone else struggling with this problem!

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

Sidebar

Related Questions

First off, I have read through a list of postings on this topic and
I have read through the solutions to similar problems, but they all seem to
I have a web server which is protected behind http-basic-auth. I've read through the
This question might seem a repeat of previous ones. I have read through a
I have read through Scott Hanselman's post on this topic. I found another article
I have read through the similar questions but do not see one like this.
I read through this article: Setting up a Symbol Server , which goes into
I have read through some articles on this topic but I am still cautious
I have read through several reviews on Amazon and some books seem outdated. I
I have read through the Rails docs for Routing , Restful Resources , and

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.