Introduce a free asp.net control with data display/input/update/delete function

Source: Internet
Author: User
Tags definition file upload integer numeric query sql server injection valid client
Asp.net| Control | data | I can't say it's stronger than a DataGrid, because the DataGrid has a lot of deep stuff to discover, but I can say it's easier and more useful than a DataGrid because it's easy to do the following, and at the same time, it's completely free and doesn't require registration. , without any functional limitations.

1, through the property to set the display of data table
2, the client data sorting
3. Format display of various field types
4, all data tables easy to implement built-in data add, update, delete function
5, the provision of password field support and use of 32-bit MD5 encoding
6, Add, update image fields, linked file fields automatically uploaded files
7, upload pictures can automatically generate thumbnails
8, add, Update automatically generated client data validation (blank character verification, the maximum number of characters to verify, digital format verification, date format verification, e-mail verification)
9, automatically to date/Time fields using date selector (JavaScript), Automatic numeric field utility digital Selector
10, Built-in image field generation program, directly display the image field
11, built-in can be customized detailed viewing page
12, the input parameters have been filtered to prevent SQL Server injection attacks
13. Prevent non-page submission
14, automatic paging technology, reduce the number of query data return
15, provide the built-in value of the field of the total function
16. Data table export Excel format directly
17. You can specify a column to use the HTML editor when adding records
18, directly to SQL Server operations
19. Support Stored Procedures
20, double table header display
21, child table display
22. Built-in Query function
23. Generate Click events for each column
24, the right mouse button function
25, built-in 21 kinds of practical styles
26, the beginning of the line can be directly generated checkbox or radio
27, a variety of data table display mode (datasheet, thumbnail, report)


More features are not covered. The following is a simple application description of the control:

First time use
1. Copy the DTABLE.DLL file to the project's Bin directory
2. Like other Third-party controls, add the control to the custom Toolbox
3. Drag the control to the appropriate location on the page
4. Rebuild the project to find that you now have access to the employee data table for the Northwind database
5. If the ASPNET user has permission to access the Northwind database on the machine you are developing, your page will display the employee's datasheet by default, or you will be prompted not to have permission to access the database.



Second, immediately display the data table you need
1, the Dtable Control data table display depends on the property to set. Typically, its properties have some default values. If you feel that it doesn't display the results you need, change the properties to get the results you want.
2, first of all, you have to specify 3 properties, so that you can immediately display your data table.
A The database connection string property dataconnectstring.
When used, set such as:
dtable1.dataconnectstring= "Data source=localhost;integrated security=sspi;initial catalog=mydatabase";
Of course, you can also encapsulate a link string in a different form or as a global variable in advance. Such as:
DTable1. DATACONNECTSTRING=INCLUDE.DATASTR;

b The name of the data table TableName.
When used, set such as:
Dtable1.tablename= "USER_TB";

c) Query statements for data lists List_sqltext
When used, set such as:
Dtable1.list_sqltext = "SELECT * from USER_TB";

3, OK, if you define the above 3 attributes in the Page_Load event, you can immediately get a list of the data tables you have defined, and dtable automatically defines the staggered row style, title style, and page bar, beginning number, and so on for the table.
4, you now double-click the first column link, you can immediately view the line of the field information. Of course, this is the dtable default allows detailed view of the results, you can also shut down, or you define the details you need to display the field or even the name of the field ... And even the type conversion of the field and so on.


Third, immediately have the record update, add, delete features without the need to write other code. All you have to do is set up 3 properties.
1. Allow the built-in update function: Ae_enableedit
Setting: DTable1. Ae_enableedit=true;

A how do I use the built-in update feature?
When the built-in update feature is allowed, the data list automatically appears with the data "Update button", and you click the button to enter the status of the update list.
b How do I change the appearance of the Data Update button?
Define the style of the Update button by setting properties: ae_editbutton_htm. For example, set the Update button for a picture edit.gif as:
DTable1. ae_editbutton_htm= "C How do I define the fields that need to be updated?
Default state, the record update interface lists all the fields for that table. You can display fields from the update interface with a property setting: Ae_fieldlist, such as:
DTable1. ae_fieldlist= "ID, name, age, sex"
At this point, the update interface simply lists the 3 fields of name, age, and gender to provide change data.
D What is the difference between recording the update interface?
Dtable provides a wide range of Easy-to-use features in the record update interface to improve data entry efficiency and input speed. For example, it automatically provides a date selector for the Date field (click on the open selector) and automatically provides a calculator for the numeric field (double-click to open the Calculator). Also, Dtable automatically generates a client's number, date, maximum number of characters, and does not allow null values for the test.
(e) Security issues relating to the recording of updates
Dtable has built-in capabilities to prevent cross page submissions: The system only updates the data submitted by this physical page, and from any other page, even if the data submitted by the page from this site is not updated. At the same time, Dtable also provides the ability to prevent duplicate submissions, you can not use the Refresh function to repeatedly submit data.
(f) How do I limit the conditions of the update?
You can set the data to be updated by property settings that must be data that conforms to a certain rule. For more information, see the advanced application of the record update and add later.
2. Allow built-in delete function: Ae_enabledelete
Setting: DTable1. Ae_enabledelete=true;
A how do I use the built-in deletion feature?
When you allow the built-in delete feature, the datasheet automatically adds a list of delete buttons.
b How do I change the style of the delete button?
Define the appearance of the Delete button by setting a property: ae_deletebutton_html:
DTable1. Ae_deletebutton_html= "c How to ensure the security of the deletion function?
As with the built-in record updates, dtable prohibits the cross-page commit delete command. Other restrictions are also provided to prohibit illegal deletion. For more information, see Record updates, additions, deletions, advanced applications.
3. Allow records to be added: ae_enableaddnew
Setting: DTable1. Ae_enableaddnew=true;
A how do I get into the record add state?
Access the record add interface by accessing the current page + parameters. Of course, the premise is that you have allowed records to add functionality. Such as:
Http://localhost/test/test.aspx?addnew=true
The parameters that come with this link below:? addnew=true to enter the record add interface. If you do not allow the record to add functionality, you do not enter the record add interface, but go directly to the data listing display interface.
b How do I define the fields that the record adds?
Like a field when you define a record: ae_fieldlist, such as:
DTable1. ae_fieldlist= "ID, name, age, sex"
Record additions and updates use the same attribute to define the fields that need to be displayed.
C How do you define security for adding records?
Update with record.
D) What is the difference between Dtable's record addition?
Update with record.


Iv. Define the data table display 1, define the display of different types of data
A) Boolean field
Boolean fields are bit types in SQL Server and allow values of 1 and 0. If our datasheet is to display a Boolean field, then the system may default to display True and false. Dtable provides a property to define the conversion of this Boolean value: List_formatboolreplace_no For example: we want to put a query select ID, name, age, sex, current salary, recent photo, diploma picture from User_ The Boolean field "gender" in the records returned by TB is replaced with "male" and "female", and you can set this property DTable1. list_formatboolreplace_no= "3| Male | female" can.
Of course, you can also set the substitution directly in the query statement.
b The field where the picture path is saved
By setting a property to tell Dtable that a field belongs to a field that holds the path of the picture, Dtable automatically uses the path to a picture label. such as: dtable1.list_urlimage_no= "|6|";
Of course, if there are more than one such field, the direct setting can be: DTable1. list_urlimage_no= "|6|7|";
Note that the numeric number here refers to the column number displayed in the list of data, and the first column of the query statement is not displayed (used as a unique identifier).
c) Currency field
Set the display of a currency field with 2 simple properties:
List_formatcur_no defines the sequence of fields that need to be displayed as a currency format, as well as the display of multiple currency fields, set such as: Dtable. list_formatcur_no= "|4|6|7"; That is: The 4th, 6, 7 fields are currency fields, shown in currency format.
Another attribute defines the prefix of the currency display: List_formatcur_str, the renminbi is set to: DTable1. List_formatcur_str= "¥"; How should the dollar be set I don't have to repeat it?
d) built-in binary image fields
Dtable allows you to directly display the built-in binary image fields. But it's not automatically starting to show up, you need to do the following to properly display:
1. Defines the column name for a binary image field: Test_imgfieldname is: DTable1. Test_imgfieldname= "Diploma picture";
2. Defines the file name used to view binary image fields. This file name is a file that the system will automatically generate. If your current directory has only one page that you use to view the binary image fields directly, you do not have to define this property. Because it has a default definition. This property is Test_showimg_filename, you can define a filename yourself: DTable1. Test_showimg_filename= "Showimg.aspx";
3. Build the file. By accessing the path + parameter of the current page, the page is immediately generated. such as: visit
Http://localhost/test/test.aspx?MakeShowImgFile=True can generate showimg.aspx this file.
If you define a column name in Chinese, you may also need to open showimg.aspx with the editor and correct the incorrect column name.
4. The above 3 steps usually need to be done only once. You finally define a property to tell dtable which fields are binary image fields: List_image_no such as:
DTable1. list_image_no= "|5|9|12|"; That is, the 5th, 9, 12 columns are binary image fields. By then, the datasheet automatically uses such a label to implement:



The following is a brief description of the control's application in data entry, update, and deletion:

First, enter the data add, update status

1, enter the data add interface

Enter the data add state by accessing the current page + parameter. For example, the current page name is: showdtable.aspx, then the path into the add interface should be http://yoursite/aspnetapplication/showdtable.aspx?addnew=true
You can access the page through hyperlinks, picture links, and button actions.
Of course, the premise is that you must allow data to be added: dtable1.ae_enableaddnew=true;

2, enter the data update interface

There are several ways to enter the data update interface.

1 through the built-in Update button to enter the update interface
To turn on the built-in Update button, you must set a property: DTable1. Ae_enableedit=true;
This property defines the ability to allow built-in record updates. Displaying the datasheet automatically adds a link to the record update by clicking the link to enter the record update interface.
Related properties:

2 through the external custom link into the record update interface. You need to set a property first: Ae_showed_button This property defines whether the link button that enters the update interface is automatically displayed when the built-in update function is allowed. The default is display.
You can define this property to be false when you decide to enter the update interface through your own definition. Note that if you enter the update interface from the outside, you must give the link parameters: Furl=xxxxx. Such as:
Http://localhost/test/test.aspx?MeditID=28&Furl=/test/test.aspx? Pageno=1
Meditid and Furl parameters are required. Meditid defines the record Id,furl defines the path of the source page that enters the update interface. You can get the current path by Page.Request.CurrentExecutionFilePath.

Second, the custom record adds the interface

1, define the fields that need to be added to the record

By default, dtable all the fields in the datasheet as needed when you add them. It provides a property that defines the fields you really need and hides the real details of the datasheet by redefining the column names for the fields.
DTable1. Ae_fieldlist= "Id,yourname as name, yousex as sex, yourage as age";
With this setting, the datasheet will display the name, gender, age 3 fields to provide input. ID as the Identity field, be sure to put it first, or you will get an error.

2, understand dtable in the record to add the interface to provide what features.

1 dtable The String field will automatically use the maximum number of characters limit, the null character test

2) dtable automatically uses radio buttons for Boolean fields. If the Boolean field allows null values, the default display is not selected.

3 dtable The date, Time field automatically using the date selector, the keyboard is prohibited. Although Dtable does not allow a date character to be entered through the keyboard, the date of the field is still detected as valid at the time of submission.

4) dtable The value, Money field automatically using Calculator input, double-click the text control to open the calculator, while allowing keyboard input. The entered character is checked for a valid number when submitted. Note that client-side numeric validation allows only 2 decimal digits, and a value greater than 2 decimal digits is considered illegal.

5) Dtable provides an immediate file upload function for the fields that record linked picture addresses and linked picture files, and can save file names, file paths to related fields, and even generate thumbnails; Do not limit the number of field changes.
For example: The 5th column of the employee table records the employee's diploma picture, and the 6th column records the training certificate picture provided by the employee, we can define the attribute by defining the attributes: dtable.ae_upfiles_no= "|5|6|";
This property tells Dtable that the 5th and 6 columns are listed as file uploads. When entering the record add interface, the 5th, 6 column position automatically displays the file control, and can automatically upload the picture at the time of submission.
Related properties:
Ae_upfile_autorename: Whether the uploaded files are automatically renamed. The default is true, which is: Allow automatic renaming
AE_UPFILESFD: Defines the path that the uploaded file needs to be saved, specify a relative path. For example:./images or.. /images/abcde
You need to be sure that your site must exist in this folder.
AE_MINIATURE_FD: Defines the path where thumbnails are stored. If this attribute is defined, Dtable thinks that all of your dtable.ae_upfiles_no-defined file upload fields will need to generate thumbnails!!
Ae_miniature_width: Generates the maximum width of the thumbnail, while specifying the maximum height of the thumbnail. Attribute category is integer
Ae_miniature_height: Generates the maximum height of the thumbnail, while specifying the maximum width of the thumbnail. Attribute type is integer

6 dtable can upload files directly to the built-in binary image fields, and there is no limit to the number.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.