Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 4 of 4

Thread: Hiding/Showing Content

  1. #1
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default Hiding/Showing Content

    I am working in Address.aspx.cs and have an issue when trying to hide a specific field. I am using "CountyDropDownData(ctrlAddress)" to pull counties into a drop down box.

    I have been trying to have the ctrlAddress.ShowCounty be true if OH is the selected state. The only problem is that I put an if statement in the ctrlAddress_SelectedStateChanged:

    Code:
    if (ctrlAddress.State == "OH" && ctrlAddress.Country == "United States")
                    {
                        ctrlAddress.ShowCounty = true;
                    }
                    else
                    {
                        ctrlAddress.ShowCounty = false;
                    }
    If the page loads and the selected state is OH, my script works fine, but when I change to another state, and clickout for the postback, and then choose Ohio, the field shows, but it's not populated. It's like the datasource isn't known. I have tried putting "CountyDropDownData(ctrlAddress);" in the selectedstatechanged event but that does nothing.

    Currently, the state has to be saved in the db as OH for the drop down to work properly. Any ideas?

  2. #2
    travisalmand is offline Junior Member
    Join Date
    Mar 2010
    Posts
    24

    Default

    If the dropdown is only shown when Ohio is chosen then could you not just populate it with the county names manually in the HTML?

    Or am I not understanding what it is you're trying to do?

  3. #3
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    I have a list of counties in a table along with what their tax rate is. I have the tax rate looking at that table to pull the customers tax rate if t hey are from ohio. That part works at least

  4. #4
    travisalmand is offline Junior Member
    Join Date
    Mar 2010
    Posts
    24

    Default

    In that case I would think the easiest solution is to manually insert the list into the dropdown as I expect Ohio won't be changing the current names or adding new counties anytime soon. Sometimes old school HTML is a better choice than that new-fangled dynamic stuff.