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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:37:31+00:00 2026-05-25T12:37:31+00:00

My ASP.NET application has a requirement, where if a user selects a country from

  • 0

My ASP.NET application has a requirement, where if a user selects a country from a country dropdownlist and if a country has a state (which usually every country has!), then a validation needs to be written down that checks that the state is selected.

If no state exists (for selected country, from country dropdownlist) then the validation should skipped and no error/validation message should thrown up.

I need to validate the state selection on the click of the button

Please guide me!

Code

   private void LoadCountry()
    {
        Country objcountry= new Country ();
        int iSuccess = 0;
        DataSet dsCtry= new DataSet();
        dsCtry= objcountry.LoadCountry();
        if (iSuccess == 0)
        {

            ddlCtry.DataSource = dsCtry.Tables[0];
            ddlCtry.DataTextField = "COUNTRY";
            ddlCtry.DataValueField = "COUNTRY";
            ddlCtry.DataBind();
            ddlCtry.Items.Insert(0, new ListItem("-- Select --", ""));
        }
    }

Thanks!

  • 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-25T12:37:32+00:00Added an answer on May 25, 2026 at 12:37 pm

    You should use two dropdownlists

    The first one is for countries. The second is for states of country.

    When user select one county, you get states of that country and bind into the second dropdownlist. And base on the size of the second dropdownlist, you can validate the selected state.

    Hope this helps ^^

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

Sidebar

Related Questions

I'm developing an ASP.Net mvc application which has a requirement to do some small,
I have a ASP.NET web application which has more than 100 pages. Each page
Well, simple question. I'm working with VS2008 on an ASP.NET web application which has
I have an ASP.NET MVC 3 application which has a post action called Create
I am developing an asp.net mvc application, which has these enity classes: public class
Here's the scenario I have an ASP.NET 4.0 application which has a LOT of
I was in a ASP.NET application has heavy traffic of AJAX requests. Once a
I have an ASP.NET MVC application that has one part where I dont really
I am creating an ASP.NET MVC application that has postcode lookup functionality. I capture
My client has a asp.net application, using ajax, he has a datagrid that shows

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.