The DotNetNuke Client API was created to help ease the amount of knowledge DotNetNuke developers must have about client-side scripting, yet allow them to take full advantage of all the benefits associated with it. The DotNetNuke Client API is a combination of both server-side and client-side code that work together to enable a simple and reliable interface for developers to provide a rich client-side experience. Prior to development of the Client API, a set of goals was established that the finished project should achieve:
Provide a means of communication between the client-side script and the server code
Allow for the functionality to be disabled and postbacks to be used as a last resort
Provide a uniform cross-browser API that a developer can program against to provide a rich UI
Allow for the API to be extended and enhanced by the Core Team and third-party developers
Because most DotNetNuke developers have at least a basic understanding of one of the ASP.NET languages, the DotNetNuke Client API was written in a manner that the majority of ASP.NET developers should be comfortable working with. Methods and objects within the Client API are accessible using a naming convention similar to .NET's namespace structure. For example, if you wanted to use the Client API to determine what browser version the end user is browsing your site with, you would call dnn.dom.browser.version.
Before you get into more details about the Client API, first look at some of the things that make this different from the majority of code covered in this book. For starters, the Client API is part of the DotNetNuke Web Utility project. This project is distributed with the DotNetNuke source versions and is found at $Approot\Library\Controls\DotNetNuke.WebUtility.
One thing quite different than most projects associated with DotNetNuke is that the DotNetNuke project itself depends on the DotNetNuke Web Utility project. Most DotNetNuke development requires your custom project to reference DotNetNuke. As a developer, the most important thing to know about this difference is that you could use the DotNetNuke Web Utility in other ASP.NET projects that are not DotNetNuke-related. This should give you an idea of how abstracted this project is, unlike most DotNetNuke-related projects, because the DotNetNuke project depends on the Web Utility project instead of the Web Utility project depending on the DotNetNuke project. The fact that most DotNetNuke-related projects are not as abstracted as the DotNetNuke Web Utility project should not turn you away from DotNetNuke development. The reason most projects are not this abstracted is because DotNetNuke is a web application framework that other projects should depend on and, at best, removing that dependency would require minimal effort to duplicate functionality provided by DotNetNuke.
While the DotNetNuke Web Utility project is distributed with the core, there is another project — the DotNetNuke Web Controls project — associated with the Client API. This project's source code is not distributed with the DotNetNuke releases available for download from the official web site. It is distributed only in its binary form with those releases. This is because the project is an official DotNetNuke project independently developed from the core releases. That separation allows the project to develop at a more rapid pace by utilizing resources outside of the DotNetNuke Core Team and not having to adhere to the same release timelines set by the DotNetNuke Core project. If you are interested in obtaining the source code to the DotNetNuke Web Controls project, it is available for download on the official DotNetNuke Web Controls project's download page located at www.dotnetnuke.com/Default.aspx?tabid=873.
The DotNetNuke Web Controls project exposes a set of web controls used throughout the DotNetNuke Core project. These controls are also available for use in other DotNetNuke functionality such as modules. The Web Controls project actually references the DotNetNuke Web Utility project. This project is also architected in a manner that enables you to use it in ASP.NET applications outside of DotNetNuke.