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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:26:19+00:00 2026-05-29T10:26:19+00:00

I have created an user control for cascading two dropdownlists province and city. But

  • 0

I have created an user control for cascading two dropdownlists “province” and “city”. But everytime when I run it, the error message said “An unhandled exception of type ‘System.StackOverflowException’ occurred”
Here is my user control code

public partial class cascadingdropdownlist : System.Web.UI.UserControl
{
    public string province_selectedvalue
    {

        set
        {
            string province_selectedvalue = value;
        }
        get
        {
            return city_selectedvalue;
        }
    }

    public string city_selectedvalue
    {
        set
        {
            string city_selectedvalue = value;
        }
        get
        {
            return city_selectedvalue;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        string a = province_selectedvalue;
        ............
    }

}

In the host page

<uc1:cascadingdropdownlist ID="province_city" runat="server" OnPreLoad="province_city_OnPreLoad"/>

The code behind is

protected void province_city_OnPreLoad(object sender, EventArgs e)
    {
        province_city.province_selectedvalue = myReader["Province/State"].ToString();
        province_city.city_selectedvalue = myReader["City"].ToString();
    }

The error happened in calling user control the province_selectedvalue.get method. why I don’t understand why? Anyone can help me, thanks very much

  • 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-29T10:26:20+00:00Added an answer on May 29, 2026 at 10:26 am

    The problem is in your property:

    public string city_selectedvalue 
    { 
        set 
        { 
            string city_selectedvalue = value; 
        } 
    

    Calls the setter (or the getter!) on city_selectedvalue over and over again resulting in a stack overflow.

    Replace your property with this

    public string city_selectedvalue { get; set; }
    

    I also thought you could do the same with province_selectedvalue but its getter refers to city_selectedvalue – is that correct?

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

Sidebar

Related Questions

I have created a WinForms user control that is a set of five cascading
I have created a user control to handle adding comments to certain business entities,
I have created a user control (CheckedDirTree) that exposes a CheckedFolder property which in
I have created an Address user control which is as follow: <%@ Control Language=C#
I have created a COM enabled .NET User Control and am wondering what is
I have a user control that I've created, however when I go to add
I have created user control for menu bar and loading in Master page. User
I have created a user control, and now I want to add custom properties
I have created a user control tha inherits from the NumericUpDown Control. Is it
I have created a user control that contains a button. I am using this

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.