.NET Tips and Tricks

Blog archive

Integrate Telerik RadControls for ASP.NET AJAX with Existing Sites

Back when I started, I used some new templates provided by Telerik to create a Web site where I could test their controls. Now that I'd gotten Telerik's controls onto the Toolbox, I figured that I should see if the controls would work on an "ordinary" site.

I opened one of my existing ASP.NET sites and dragged Telerik's DateTimePicker on to a page with ASP.NET's ScriptManager control. That got me two new DLLs in my bin folder (see figure 1). Other than adding a Register tag that referenced the Telerik DLL, nothing else seemed changed.

[Click on image for larger view.]
Figure 1. Dragging a Telerik control onto a page in your site adds two new DLLs to your bin folder.

I noticed that, in the Telerik-generated project, my web.config file had included some references to Telerik's spell check component. To see what would happen if I tried to use that control without the entries in the web.config, I dragged Telerik's spell checker onto the page. On its SmartTag I found an entry called "Enable RadSpell HttpHandlers." Clicking on it generated two dialogs informing me that my web.config file had been updated (and, when I checked, it had, of course). The enable option disappeared from the SmartTag once its work was done, also.

Being of a perverse frame of mind this day, I deleted the entries in the web.config file, saved it, and clicked on the spell checker's SmartTag -- the "enable handlers" menu choice came back. It's nice to know that the controls will protect themselves from me.

[Click on image for larger view.]
Figure 2. Some of Telerik's controls require entries to a site's web.config file. These can be added from an entry on the control's SmartTag.

While hardly a complete test, it suggests that integrating Telerik controls with an existing website is certainly doable -- the controls will add the support they need (and only the support they need) as they're incorporated into pages. It also suggests that the Telerik controls are comfortable working with ASP.NET's ScriptManager which is another good thing to know.

Don't get me wrong: I wouldn't be surprised to find that, down the line, I might run into a situation where some necessary item wasn't added automatically to the web.config file and I'd have to add it manually (the dictionaries that the spell checker needs didn't seem to get added to the App_Data folder, for instance). But, on the other hand, I've no desire to work through every control in the suite looking for something to go wrong and the controls seem to handle the "typical case."

Onto the AJAX Extensions
I'm finally feeling comfortable enough with Telerik's RadControls for ASP.NET AJAX to try, you know, actually using them. I returned to the project with the page that I'd created from the Telerik templates in yesterday's blog (Digging into Telerik RadControls for ASP.NET AJAX). From what I'd seen, it's obvious (now) that the "Scenario" choices on the Telerik menu are there to generate sample pages to let you play with the controls.

You can read the initial VS Toolbox review of the product here.

What's interesting are the controls that go onto those sample pages. In addition to whatever control you selected, you get Telerik's RadScriptManager, RadAjaxManager, and RadStyleSheetManager. I know that Telerik's controls work with the standard ScriptManager, so the RadScriptManager either speeds up processing or adds additional functionality. The RadScriptManager definitely has some additional functionality: there are new CDN settings that seem to point to a Telerik server and enableScriptCombine is replaced with HttpHandlerUrl.

RadAjaxManager, it turns out, is a better version of the UpdatePanel. Rather than drop controls into a Panel, the RadAjaxManager gives you two lists of controls on the page. On the left-hand list, you check off controls to generate postbacks like controls in the UpdatePanel do (you still have to set the AutoPostBack property on the control to True). On the right-hand list, you check off the controls to be updated without a full page refresh when the results come back from the server. The property window on the far right lets you create a little whirly to spin while the postback is in process. It's sort of an UpdatePanel without the Panel and lets you scatter your AJAX-postback controls across the page instead of having to group them into panels.

The RadXMLHttpPanel also goes beyond the UpdatePanel, but does it by reducing the overhead involved in using the UpdatePanel. Like the UpdatePanel, only controls inside the RadXMLHttpPanel are refreshed. Unlike the UpdatePane, which causes all server-side events to execute, the RadXMLHttpPanel allows you to specify the WebMethod to call to fetch the data you want and skips the rest of your server-side code. The payload going up to the server is still fixed, though, and includes the ViewState.

While the control sounds cool, the documentation for it is sketchy. The 800 page training package, which I mentioned at the end of yesterday's blog, doesn't include anything on the RadXMLHttpPanel, for instance.

The RadStyleSheetManager allows you to combine calls to stylesheets to download multiple CSS stylesheets in one trip. Also a good idea.

Tomorrow I'll wrap up the in-depth exploration of Telerik RadControls for ASP.NET AJAX with a look at client-side development.

Posted by Peter Vogel on 05/27/2010

comments powered by Disqus


Subscribe on YouTube