10.4. Summary

This chapter showed you how to create a query builder control that can be used for filtering reports, HTML tables, or even exports. It also provided an example of a server-side control that supports AJAX functionality and used the ASP.NET AJAX Control Toolkit found on www.asp.net. Custom attributes were also used to define the fields that can be queried by the control. This control can save plenty of development time, especially when it comes to reports.

The steps to create an object that supports querying capabilities are as follows:

  • Create a data class that inherits from ENTBaseQueryData.

  • Implement the SelectClause and FromClause methods in the data class.

  • The data class must pass in a generic class that will be passed back to the business layer; this is always an entity class. To create this entity class you can take the Select and From clauses and create a stored procedure and then use the ORM Designer to automatically generate the entity class by dragging the stored procedure to the Methods pane. Once the entity class is created, you can delete the stored procedure from the database.

  • Add the appropriate QueryField and RequiredQueryField attributes to the top of the data class.

  • Create a business object class that inherits from ENTBaseQueryBO. There is nothing to implement in this class if you use its default functionality.

  • Create a Web Form and add the AJAX ScriptManager and QueryBuilder controls.

  • Set the QueryBuilder control's QueryObjectName property to the business ...

Get ASP.NET 3.5 Enterprise Application Development with Visual Studio® 2008: Problem - Design - Solution now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.