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 7 of 7

Thread: get combobox value for if statement

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

    Default get combobox value for if statement

    I am trying to get a drop-down to show when the value in state is set to Ohio. I have it working when I do the event once the page is loaded (i.e. click state and choose Ohio). I want it to automatically show the _cboCounty on page load if the value of the state from the database is Ohio. I tried the following code in the SetDefaults() in AddressControl.cs but with no luck:

    Code:
    if (_cboState.DataValueField == "OH")
                {
                    ShowCounty = true;
                }
                else
                {
                    ShowCounty = false;
                }

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

    Default

    When I am trying to set the ShowCounty = true; in SetDefaults(), does my if statement not know what the value is until the page is fully loaded because this works fine in my OnSelectedStateChanged() function?

    Code:
    if (_cboState.SelectedValue == "OH")
                {
                    ShowCounty = true;
                }
                else
                {
                    ShowCounty = false;
                }

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

    Default

    Does anyone know where the default values from the db are set to the drop-downs for the address information (shipping/billing)?

  4. #4
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    Those dropdowns are created & populated in Address.InputHTML (source code required, in the ASPDNSFCore project).

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

    Default

    Is this the same spot where values are set when the pages loads from the db for customers who are logged in?

  6. #6
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    it should be the same code yes
    AspDotNetStorefront
    Shopping Cart

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

    Default

    The code in Address.cs only seems to output the option values for when a person is registering the first time. I can't seem to find where the option values are populated from for address.aspx when a person is already registered and just modifying their address or adding an additional one. Any ideas?