There are a lot of good stuff in codeproject.ArticleAnd source code, looks very tasty. I 'd like to introduce you to some of them. strive to maintain a single day, so as to encourage yourself to learn and update the blog :). it's just an introduction, not a translation. Try to translate the introduction part of the author and clarify its functions so that everyone will be interested in it.
Sqlwherebuilder ASP. NET Server Control by Mike Ellison
Sqlwherebuilder is a web control that allows you to customize where query conditions in SQL. you can use this interface to customize variable REPORT query conditions. developers can use the getwhereclause () and getwhereclausewithparameters () Methods to assemble query conditions into the WHERE clause in SQL when returning the page. it is designed with two main goals: (1) processing user interaction on the client to avoid too much backhaul; (2) making full use of ASP.. NET Server to improve flexibility.
To meet the previous goal, the client function is developed into a separate JavaScript library, and the control is tested in IE 6.0, Firefox 1.0, and Netscape 7.1. browsers that support the following features should be applicable:Javascript1.2, document. getelementbyid () function, innerhtml attribute, display attribute of none and inline in CSS.
For the next purpose, the control allows developers to use XML file configuration to generate a where clause with the same syntax as idbdataparameter to integrate with idbcommand types. this article introduces the control, describes the configuration task, demonstrates how to obtain the WHERE clause, and describes how to draw and transfer conditions between the client server.
The UI of sqlwherebuilder includes the following parts:
(1) "condition" list: displays the conditions added by the user
(2) "field" drop-down list: displays the Field List of the database. You can customize a condition by selecting "field.
(3) "operator" drop-down list: Select "field" and display the appropriate operator according to the developer's configuration. for example, text fields may correspond to the "is", "is not", "contains", and "is null" operators. numeric fields may include "equals" and "is greater. the operator corresponds to sqltemplates. sqltemplates is used to convert conditions into corresponding where clauses.
(4) "value" Area: "operator" is selected, and the corresponding "value" area is displayed for the user to enter the value for comparison. the "value" area is drawn as a <div> label. When you select an "operator", it is displayed or hidden. It includes text or HTML. The client script Library supports text, <input> tag and <SELECT> tag of the radio type. you can also use usercontrol (. ascx ). the "value" area contains only one text box.
After adding conditions on the page, the conditions are displayed in the "conditions" list. The Delete and edit buttons are displayed next to each condition. the "And/" drop-down list will appear before the first condition after the user customizes to meet the requirements. click the "edit" button to edit it in the same place.
To use the sqlwherebuilder control, developers need to copy the Javascript library file to a proper location on the server and use XML orCodeTo configure the "field" drop-down list, "operator" drop-down list, and "value" area visible to the user.