Using the Toolkit

Once you’ve added the toolkit to the project, you can use its controls in your web site. Let’s demonstrate how it works by adding one of its simpler controls to a web page, the ConfirmButton control. ConfirmButton displays a JavaScript confirmation dialog box (using the window.prompt() method, of course), which asks the user whether to continue the current operation or not. If the user clicks No, the action is cancelled. This makes sense when posting a form by clicking on a LinkButton or a regular button: if No is clicked, JavaScript is able to cancel the click on the button, so that the form is not submitted.

Before you can use any toolkit controls on a page, you have to register the toolkit by adding the following markup to the page (which will be done automatically for you if you drag a toolkit component on the page in Design view):

<%@ Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit"
TagPrefix="atlasToolkit" %>

You use the name that you assign to the TagPrefix property every time you reference a control in the toolkit. If you don’t assign a TagPrefix value, whenever you drag an extender from the IDE Toolbox to the design surface, the IDE assigns the prefix cc1 by default. The atlasToolkit prefix is more descriptive. You’ll also need to add a ScriptManager control to the page for the toolkit controls to work

Most controls in the Atlas Control Toolkit provide their functionality by extending the functionality of other controls on the page. ...

Get Programming Atlas now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.