How can we populate a dropdown list with parent and child values like the forum jump dropdown at the bottom of this page?
This dropdown shows the group names and then the forum names below each group title.
Many thanks
RGHow do you get the relationship delivered? In a dataset or do you connect each time that you enter a new parent id?
You can add the items to the DDL by using Items.Add(new ListItem(..., ...));
Grz, Kris.
If you view the source of the pages of these forums, you will see that there is nothing special going on with the dropdownlist at the bottom. The subheadings and formatting are created with blank rows and such. The headings are just the same as any of the "actual" items and selecting them causes a postback (albeit a postback that does nothing).
<option value="">(please select)</option>
<option value=""></option>
<option value="/">Forums Home</option>
<option value="/search/">|- Search Forums</option>
<option value="/TopicsActive.aspx">|- Active Topics</option>
<option value="/TopicsNotAnswered.aspx">|- Unanswered Posts</option>
<option value=""></option>
<option value="User Options">User Options</option>
<option value="/user/EditProfile.aspx?ReturnUrl=/ShowForum.aspx?ForumID=18">|- My Control Panel</option>
<option value="/user/PrivateMessages/">|- My Private Messages</option>
<option value="/user/MyForums.aspx">|- My Forums</option>
<option value=""></option>
You can see some usefulsamples here.
If you don't want to code it yourself, consider using a third-party control likeEasyListBoxor Andy Smith'sListLink (free, but unsupported and not as user-friendly).
FWIW...
0 comments:
Post a Comment