RadControls for ASP.NET AJAX To add RadInput for ASP.NET AJAX to an existing ASP.NET web application you need to follow these steps:
- Make sure you have installed ASP.NET AJAX. Info can be found at that address.
- If your web application is not using ASP.NET AJAX you need to configure it to do so. Detailed instructions can be found at http://msdn.microsoft.com/en-us/library/ff647506.aspx (Look for the topic called "Adding ASP.NET AJAX Configuration Elements to an Existing Web Site".)
- Add a ScriptManager control to the page (or user control) in which you want to add any RadControls for ASP.NET AJAX.
<asp:ScriptManager ID="ScriptManager1" runat="server" />
If your page is a content page you can add the ScriptManager control in your master page. For further details about the ScriptManager control, see http://msdn.microsoft.com/en-us/library/bb398863.aspx. - Drag and drop a control from the RadControls for ASP.NET AJAX package or manually copy the Telerik.Web.UI.dll in the Bin folder.
- Replace the classic RadInput directive
<%@ Register Namespace="Telerik.WebControls" TagPrefix="rad" Assembly="RadInput.NET2"%>
with the new one of RadInput for ASP.NET AJAX:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
Differences between RadInput "classic" and RadInput for ASP.NET AJAX
RadInput for ASP.NET AJAX has changed its client-side API slightly because of moving to the ASP.NET Ajax framework and to the Telerik.Web.UI suite.
- The way to get a reference to the client-side object has changed. The new method is demonstrated in the following example:
Copy[JavaScript] Getting the client-side object
var dateInput = $find("<%= RadDateInput1.ClientID %>");
- The naming convention for properties and methods has changed. Where in RadInput "classic" all property and method names start with a capital letter, in RadInput for ASP.NET AJAX, they start with a small letter:
| RadInput Classic | RadInput for ASP.NET AJAX |
|---|
| window["<%=RadInput.ClientID%>"].Enable(); | $find("<%=RadInput.ClientID%>").enable(); |
| window["<%=RadInput.ClientID%>"].Focus(); | $find("<%=RadInput.ClientID%>").focus(); |
- Properties in RadInput for ASP.NET AJAX are accessed through "get" and "set" methods, as shown in the following examples:
| RadInput Classic | RadInput for ASP.NET AJAX |
|---|
| window["<%=RadInput.ClientID%>"].Enabled | $find("<%=RadInput.ClientID%>").get_enabled() |
| window["<%=RadInput.ClientID%>"].Enabled = true; | $find("<%=RadInput.ClientID%>").set_enabled(true); |
- The signature for client-side events has been unified, so that all event handlers have two arguments:
- The first argument (sender) points to the RadInput client instance
- The second argument (eventArgs) is a holder for the old arguments passed in the respective handler.
To cancel an event (which can be cancelled) you now call "set_cancel(true)" on the eventArgs argument, as shown in the following example:
Copy[JavaScript] New event signature
function ValueChanging(sender, eventArgs)
{
eventArgs.set_cancel(true);
}
</script>
<telerik:RadTextBox runat="server" ID="RadTextBox1">
<ClientEvents OnValueChanging="ValueChanging" />
</telerik:RadTextBox>
<% - New properties and methods have been added to the client-side API. See the "Client-Side Programming" chapter for details.
See Also