Retrieving the States of a Country from DNN Lists
Last Post 08-26-2009 07:28 AM by David To. 3 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
vr1001 vr1001User is Offline
river guide
river guide
Posts:115
Avatar

--
08-24-2009 01:12 PM

    Hi,

    Based on David's message I was able to populate a State field using the DNN Region list

     

    Select '-Select State-' as QuestionOption, '-1' as QuestionOptionValue
    Union All
    select Text as QuestionOption, Text as QuestionOptionValue from Lists where ListName= 'Region' AND ParentID = 221

    We could do this because David told us 221 is the Id for USA.

    I would like to know IDs for Canada and Mexico please

    Also this raises another question. If ParentID is expecting such numeric values, how will the following statement will work

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    08-24-2009 01:37 PM
    You can find it out youself as well. Just go to HOST / SQL and type in:

    select listname,value,text,parentid from lists where listname in ('Country','Region')
    order by listname,text,parentid

    -- David
    vr1001 vr1001User is Offline
    river guide
    river guide
    Posts:115
    Avatar

    --
    08-26-2009 06:57 AM

    Hi David,

    I really appreciate your VERY prompt answers. Thank you!

    I am able to get the desired results using your tips.

    But... I want these results dyna,ically based on the selected "Country" rather than hard coding the country code.

     

    Ideally, I willhave just ONE State field (combobox) whose entries should be populated based on the selection made in the "Country" combobox. {just like DNN Country, Region List]

    All the examples given on this site (more specifically those given in Demo 11) use a variable in the WHERE clause like:

    select text as questionoption,value as questionoptionvalue from Lists where listname = 'Region' and ParentID = '$(mycountry)'

    [where MyCountry is the short name for the Country Combobox]

    Since that is NOT working in my case, I am forced to create THREE comboxes - one each for USA State, Canada Province, and Mexico State. Using Question events, I am showing teh relevant State List based on the Country selected. Within each State list combobox, I am using hard coded SQL like:

    select text as questionoption,value as questionoptionvalue from Lists where listname = 'Region' and ParentID = 221

    And finally, I created a 'hiddenState' and writing the selected State from each of the three State comboboxes. This will contain the "latest selection' from any of the three State lists.

    To avoid these work-arounds' I really appreciate if you can point me to a page that gives details on how to use a "variable" in the WHERE Clause for ParentID.

    Thanks a lot in advance!

    VJ

     

    David ToUser is Offline
    river guide
    river guide
    Posts:2719
    Avatar

    --
    08-26-2009 07:28 AM
    Your token value should work. What you need to do is this:
    Leave your Country field the way you have it now. But for your State Field, under Advanced Options, make it "Hide until forced visible by question event". Use the same exact SQL query you had above.
    Under question events, create an event to unhide the State based on any response from the Country field. Try this out and see if it works for you. The trick is you need to set up a question event to trigger a postback and unhide the State field. -David


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi