Introduction:
In this article I have explained about "Zero Server controls technique". I have implemented the new record insertion using the XML data type. For deletion of the record I have used the JavaScript tricks and Ajax. The record display in the table format, I have chosen the XML and XSLT. I have explained the Dynamic HTML technique using the Ajax techniques. But this time I have chosen this XSLT transformation technique.
Background:
The following things have been used in this project.
- XML Insertion
- Delete record using AJAX and JavaScript tricks.
- Code files under app_code folder for DAL and Business logics.
- Separate Script file for handling the JavaScript and AJAX.
- XSLT for display the record calling from Client side.
XML Insertion:
Normally we write the server side event handling for insert the record into the database. It will execute in the server side code and need to rebind the grid to show the recent data. But here I have written the code using the Ajax to insert a record into the database and it will display the record using XSLT. In case of failure then it will show the error message and it will not call the binding method of the record display.
Deletion:
Here I have implemented the Ajax technique to delete the record in the backend. Using the JavaScript it will hide that record. I have added one more column in the Authors table for the status of the record. Active record will be 1 and inactive records will be 0.
Display record in XSLT format calling from JavaScript:
The XSLT have been implemented to display the records of the authors. When the page gets load it will be displaying the record using the XSLT. When new record inserted then once again it will be rebinding the records from the database.
Sample Screenshots:
(a) Insert a record into database using AJAX
(b). Delete the record using AJAX.
Conclusion:
I have used the C# code files for the Database Accessing and Business Logics. The separate CSS and JavaScript (.js) file have been used. The group JavaScript validation has been implemented. There is no server side controls have used in this application. XML and XSLT have been used. This project will give you an idea like writing the code without any refresh through this application. Source code has been attached. Please post your valuable feedback and suggestions or corrections. Thanks in advance.