It really depends how complex your requirements are. I setup a simple example just now; I have a drop down list to tell me the top level pages of my site called FieldA
and a second drop down list that will show me all of the child pages of FieldA which I named FieldB
.
FieldA
has a SQL query of
select ‘please select’ as NodeName, null as NodeAliasPath
union
select NodeName, NodeAlisaPath from cms_tree with(nolock) where NodeLevel=1
This field is also set as required and marked as having dependent fields.
FieldB
has its Visibility set to FieldA!=null
and a SQL query of
select NodeName, NodeAlisaPath from cms_tree with(nolock) where NodeAlisaPath like '{%FieldA%}%'
It is also marked as Depends on another field.
That is a very simple way to get it to work that requires no code behind. So if your structures are simple, you can use that. Where they are more complex, you may want to create your own drop down control, but just keep it simple and use the field dependencies.
If you can, I'd recommend haveing a look at creating macro datasources for your dropdown lists, as this might give you more flexibility. There are some tips for this here: Registering custom macro methods