Join our DNN Community    (Newsletter, Tips, Tricks and Forums for DNN Skins & Modules)

 


 
Microsoft Gold Certified Partner - DNN Benefactor

DotNetNuke Powered! 


Thursday, November 20, 2008 Register · Login · Contact · Search:  
Company Solutions Portfolio Contact
Forums
Samples and other shared info.

Subject: Drop Down List Manager Sample

You are not authorized to post a reply.   
Author Messages
pauldes
Immortal
Posts:1392

10/27/2006 4:32 PM Alert 
This application will allow you to manage all drop down lists throughout your application WITHOUT having to edit your forms constantly to update the choices in the lists. Plus it gives you a central administration tool to manage the contents quickly and easily.

For every <select> tag or similar element you use, simple insert the following syntax, replacing the name, id, etc. in the element, as required by your web application. Change the "LIST NAME HERE" to the list you create in this application and the drop down list will then populate with the options you have entered.

<select name="frm_field" class="FormDataA" id="frm_field">
<option value="NULL">*None</option>
{SUBQUERY,
Name="qry_category",
Query="Select uc.user_choice_string_name, uc.ordinal from dbo.user_choice_choices uc
JOIN dbo.user_choice_names un on uc.user_choice_names_id = un.user_choice_names_id
WHERE un.user_choice_name = 'LIST NAME HERE' order by ordinal",
Format="<option value="[user_choice_string_name]">[user_choice_string_name]</option>",
SelectedFormat="<option value="[user_choice_string_name]" selected="selected">[user_choice_string_name]</option>",
SelectedField="user_choice_string_name",
SelectedItems="[FORMAT,[frm_field,Form],{ISEMPTY:}]",
UseCache="False"}
</select>


To install follow these steps.

1. Run the UserChoiceList.sql to install the two new tables for this application in your DNN instance.

2. Add a page to your site.

3. Install a ListX module and call it User Choice Lists. Take the attached UserChoiceLists.xml file contents and copy and paste it over the XML configuration in the View Options. Click load and save configuration.

4. Install a ListX module BELOW the first module and call it User Choice Choices. Take the attached UserChoiceChoices.xml file contents and copy and paste it over the XML configuration in the View Options. Click load and save configuration.

5. Go to the User Choice Choices Module Settings and add the following code in the Advance Settings>Module Header field:
<script language=javascript>
var mUserChoices=[moduleid,system]
</script>

6. Create a new choice list and add some choices.


Attachment: UserChoiceLists.zip


ListX....makes you look brilliant, even though you're not.
mrwebslinger
Superweight
Posts:357

02/09/2008 2:50 PM Alert 
Paudles (or whomever)

When you use tables as I do all the time to generate pull down lists, do you store the selection's ValueID or the actual Value (Item Display) in the main table. I generally just store the ValueID and then do an inner join to grab the Value when I am wanting to display the information again. I have seen it both ways which is why I am asking. I would think if you thought you would ever change the Value then saving the valueID would save from doing a lot of search and replacing.

pauldes
Immortal
Posts:1392

02/09/2008 4:17 PM Alert 
When I do this and why I do this is so that
1. it's easier to get the data for display purposes, and other things(personal preference). It also allows ME to give the USER their own interface to manage the application. They can control what categories they want on a form, etc. That is the biggest plus of this scheme to me.
2. It makes it easier and less support intensive for users to do data reporting, etc. when they don't have to comb through and learn tables and joins to find a state name or a category value for their report.
3. This method allows you to change your choice lists, without affecting the data in current and historical records.
4. Makes the work of managing many lookup tables, databases and interfaces that use these tables nonexistant(probably the most valuable reason to me personally). For example, in my application, I use about 60 tables....but I have about 30 choice lists. That would be and additional 30 tables potentially.

Anyway, I'm sure there is a counter arguement as to why not to manage lists this way by someone smarter than me.... but also note, DNN themselves uses a scheme similar to this with their Lists table.

Update table set category = 'xxx' where category = 'yyy'
Innner join tableb on tablea.categoryid = tableb.categoryid

Seems to me that they take about the same amount of time to type plus I would type my statement a lot less often!
:-D

ListX....makes you look brilliant, even though you're not.
You are not authorized to post a reply.
Forums > Bi4ce.Modules.ListX > Samples and other shared info. > Drop Down List Manager Sample



ActiveForums 3.6
Latest Post
 
At R2integrated (formerly Bi4ce), we take support seriously.  That's why we support our customers and DNN community with daily monitoring from our experienced engineering team.  We ask that the first step taken is to read the relevant documentation and support forums prior to submitting any questions that may already be available or have been answered.  We ask that you review the documentation that we provide for our products before posting a question.

The Forums are for our customers to chat, exchange ideas and strategies, and submit feedback.  Please be sure to perform keyword searches for previous related forum responses.

To be helpful when submitting a new item, please include the following: 
  1. DNN Version
  2. Module Version
  3. Admin Log Viewer Information
  4. Environment detail: Operating system, .NET framework version, database and version, IIS version, Browser version (if appropriate)
We always try to respond quickly and monitor the forums daily during business hours (EST).  Occasionally, requests for a specific project requirement may not apply for the free support offered. For project specific support please submit via our Information Request form.

Thank you for using our Forums.

Click here to register for the Forums
 
© 2008 by R2integrated (formerly Bi4ce) | DNN® is a registered trademark of DotNetNuke Corporation