en-USzh-CN
Search
You are here:Support  >  Articles
Articles
For this article, it will teach you how to make Dropdown list, checkbox list, radiobutton list and listbox these four kinds of controls get data from database via one SQL query.
For example, you have five fields Name, Sql Dropdown, Sql Checkbox list, Sql Radiobutton list, Sql Listbox in your form.
And you want to read data from Users table of database, username as Item Text, UserID as Item Value.


Configuration Steps
1. Firstly, you need to enter Management Center -> Step Wizard page and then click “Add A New Step” to add one Step. Finally, please click “Add A New Filed” button.


2.In Title, please enter ”Sql Dropdown” and choose “Drop-down List” for “Control Type” option. Finally, please enter following sql sentence in “Value” option.
[SQL]select username,userid from users

Please note, you need to enter [SQL] Token in the head of Value Textbox. In this way, programming will execute sql query behind [SQL] Token. First field of Sql query represents Text in Dropdownlist, second field represents Value in Dropdownlist.

Configuration method of checkbox list, radiobutton list and listbox controls is the same with Dropdownlist.


3. After you finished configuration, you will see following interface in the front-end.

Below, you will find download link for xml configuration file of form. You can go to Management Center -> Copy Form page and import it. In this way, you will get this form instantly.

read_data_from_sql_query_config.xml
about author

DNNSmart

Developer

Although DNNSmart was newly founded in August 2012, we devoted to DNN development work since 2008. We specializes on the DotNetNuke (DNN) Content Management System including DNN skin design, DNN programming and website construction. Our development team is located in China, our professional and outstanding developers are passionate about web design, programming and web applications.

Comments ()

    Leave a comment

    2000 character(s) remaining. Comment limited to 2000 characters.
    Post Comment
    Search
    Categories
    Calendar
    Authors
    Archives
    Home   |   DNNSmart Store   |   Free Downloads   |   Support   |   Service   |   About Us