Does that subject looks lame or what! I'm trying to stop using the “Atlas” name -- it's ASP.NET AJAX now, and getting used to the new name is a major pain in the backside. Even though the official name Jessie-James-Garett-certified name is Ajax (note the capitalization), Microsoft chose AJAX. Anyway, I hope I'll get used to it eventually.
All this does is create a global Telerik object and then attach a Samples one onto it, so that you can create subobjects yourself. Here’s how we define a class after that:
Telerik.Samples.ImageSlideShow = function(element)
A class is defined by its constructor function. Note that our class would want to call its base class’ constructor, so we use the initializeBase method that is provided by the ASP.NET AJAX component model. The last thing we need to do is register the class with the type infrastructure:
registerClass requires two parameters: the full class name and the type of the class you inherit from. It takes care to provide the initializeBase method that you saw already.
That’s all! We now have an empty control class. How do we use it? First we need to include the script file on the page. We do that by using the ASP.NET AJAX ScriptManager server control:
<atlas:ScriptManager ID="ScriptManager1" runat="server">
<atlas:ScriptReference Path="~/ImageSlideShowEmptyClass.js" />
ImageSlideShowEmptyClass.js has the definition of our class. We can then define a pageLoad global function and exercise our code there. pageLoad will be automatically called by the runtime right after initialization is complete:
var slideShow = new Telerik.Samples.ImageSlideShow($("ImageSlideShow1"))
Here's a quick preview on what we'll cover in the next posts:
Stefan Rahnev (@StDiR) is Product Manager for Telerik Kendo UI living in Sofia, Bulgaria. He has been working for the company since 2005, when he started out as a regular support officer. His next steps at Telerik took him through the positions of Technical Support Director, co-team leader in one of the ASP.NET AJAX teams and unit manager for UI for ASP.NET AJAX and Kendo UI. Stefan’s main interests are web development, agile processes planning and management, client services and psychology.
Subscribe to be the first to get our expert-written articles and tutorials for developers!