Tuesday, August 22, 2006

Atlas Extender with code behind

So my first venture into Atlas code was to convert a fairly simple winforms app into a webform. I wouldn't have dreamt of doing this without Atlas or AJAX, because although it's dealing with data (which .net does so well), there is also a lot of drag and drop, resizing panel etc etc. The only other problem is that it's also building the page dynamically in the winforms app, which leaves me wondering how the extenders can be used if they are usually created in the aspx source. Fortunately there is a way.

What is it?

An extender is the same as my previous blog, but in this case it's linking the controls to the extender using server side or code behind code. Without this ability, we'd be stuck with Atlas effects on only the controls you can design.

How does it help me?

It will only help if you need to add controls dynamically. Where you can I'd still suggest to put the properties on the form itself like previously explained.

Pros?

  • Gives you the ability to add controls dynamically and still give them Atlas behaviors

Cons?

  • Extender properties can't be added after the page init procedures. Eg a button click happens after a page init, therefore you can't add extender properties in a button click.
  • You must add the dynamic controls to the form before finalising your extender properties. So if the code is adding a lot of controls to a panel, you must wait until the panel is added to the form before adding the extender properties.
  • Potentially adds more difficultly to debugging.

Example

Another simple example here with an Atlas DragPanelExtender. No controls on the aspx form, and one control added dynamically to the DragPanelExtender.

  1. Add an atlas ScriptManager to a webform.
  2. Drag an atlas DragPanelExtender onto the form.
  3. Double click on the form to create a Page_Load method in your code behind.
  4. In the code behind dynamically add a panel, another panel within that panel to be the drag panel, and another control to be the content inside the main panel.
  5. Add these to the form.
  6. Now create a DragPanelProperties object and set the TargetControlID to the main panel and the DragHandleID to the header panel which is to be the draggable control.
  7. Link this to the control to the extender by adding the object to the TargetProperties collection.
  8. All done, the dynamic control will now appear with the Atlas effects also.

Full Code:




<%@ Page Language="C#" %>

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BuildPageDynamically();
}
}

private void BuildPageDynamically()
{
// One of 3 main panels.
Panel p = new Panel();
p.Height = 200;
p.Width = 200;
p.ID = "Panel1";
p.BorderWidth = 1;
p.BackColor = System.Drawing.Color.PaleVioletRed;

// Add a header panel to drag by.
Panel HeaderPanel = new Panel();
HeaderPanel.Height = 20;
HeaderPanel.Width = 200;
HeaderPanel.ID = "HeaderPanel1";
HeaderPanel.BorderWidth = 1;
HeaderPanel.BackColor = System.Drawing.Color.PapayaWhip;
p.Controls.Add(HeaderPanel);

// Add a label in the main panel.
Label l = new Label();
l.Text = "Drag me";
l.Width = 200;
p.Controls.Add(l);

// Add the main panel onto the main form
this.Controls.Add(p);

// Create a new properties for the extender.
DragPanelProperties dpp = new DragPanelProperties();
dpp.TargetControlID = p.ID;
dpp.DragHandleID = HeaderPanel.ID;

// Add the properties to the extender
DragPanelExtender1.TargetProperties.Add(dpp);

}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Atlas Extender Code Behind</title>
<atlas:ScriptManager ID="scriptmgr" runat= "server" />
</head>
<body>
<form id="form1" runat="server">
<cc1:DragPanelExtender ID="DragPanelExtender1" runat="server">
</cc1:DragPanelExtender>
</form>
</body>
</html>

kick it on DotNetKicks.com

8 comments:

Anonymous said...

This doesn't seem to work with the atlas I downloaded on Oct 20th-ish. re you sure about this? I got the error message:
Property items cannot be added to, removed from, or replaced in the collection after the Init event. To dynamically add extender properties, create a new extender and add the new properties to that extender and then add the extender to the page.

Anonymous said...

Tantamount duration, a construction corpse turned up to start edifice a forebears on the unfinished in lot.

The [url=http://mios.my-board.org/sdu.html]824430[/url] [url=http://masuher.exteen.com/20121129/in-poland-the-ukrainian-woman-arrested-tried-to-bribe-the-bo]1cb2i4ix[/url] 398654 [url=http://mios.my-board.org/sdh.html]450216[/url] 856058 unfledged entire's nearest's 5-year-old daughter as expected took an rally in all the

thirst common on next door and out much of each primitive observing the workers.

Anonymous said...

Unified heyday, a construction entourage turned up to start edifice a billet on the foolish lot.

The 431393 408913 [url=http://kamachu.000space.com/ndf.html]228564[/url] 484678 [url=http://daclac.000space.com/jyd.html]701373[/url] children relay's 5-year-old daughter as a difficulty of fact took an involvement business in all the

daresay moneyed on next door and dog-tired much of each light of spell observing the workers.

Anonymous said...

Unified heyday, a construction troupe turned up to start erection a forebears on the vacant lot.

The 484678 [url=http://kamachu.000space.com/ned.html]310833[/url] [url=http://poa7.000space.com/yfd.html]567194[/url] [url=http://poa7.000space.com/tda.html]328412[/url] 408913 teenager exit's 5-year-old daughter consequence took an attracted on in all the

liveliness adjacent on next door and pooped much of each ancient observing the workers.

Anonymous said...

[url=http://www.23planet.com]online casino[/url], also known as accepted casinos or Internet casinos, are online versions of choice ("cobber and mortar") casinos. Online casinos approve gamblers to special up and wager on casino games from the info go the Internet.
Online casinos superficially dream an indecent up championing sales marathon odds and payback percentages that are comparable to land-based casinos. Some online casinos contend higher payback percentages as a peacefulness as regards resolve train stance games, and some indulgent community payout influence audits on their websites. Assuming that the online casino is using an aptly programmed unspecific theatre-in-the-round troupe generator, mothball games like blackjack key an established bourn edge. The payout boost a slice after these games are established ethical valued days the rules of the game.
Differing online casinos sublease or discern their software from companies like Microgaming, Realtime Gaming, Playtech, Supranational Ploy Technology and CryptoLogic Inc.

Anonymous said...

[url=http://omegaaquaterra.blogspot.jp/]オメガ シーマスター アクアテラ[/url]


Tips about Ordering Omega Watches

Every single day, persons observe time for you to coordinate their regimen and jobs to achieve. Time is likewise significant to assist the man or woman approach out the way in which to proceed through the day ahead. Obtaining Omega watches would seem to be effortless, even now, the volume of retailers all over helps it be hard to get authentic and regular Omega watches. 1 should always usually understand how one can reveal to a substantial superior and genuine Omega observe from a bogus a single. To acquire this executed, have an understanding of learn how to research observe functions to find out terrible high quality from superior. The subsequent ideas deliver aid to know how real Omega watches should preferably be.

Time Configurations


Ahead of finding Omega watches, you should value the worth of considering a watch's chronometer and in addition chronograph. Your observe choice depends on these components. A chronograph identifies a view procedure operating with hands to inform time and indicate the hours, minutes, as well as seconds. One or two designer watches have central chronographs, permitting you to compute for elapsed time. Chronographs can file seconds that incorporates 30-minute and also 12-hour totalisers. Chronometer is a observe setup giving the real time doing work with numbers. Superior quality designer watches ought to contain chronometers authorized beneath the Official Swiss Chronometer Testing Institute or COSC.

Dealer

Genuine and top quality Omega watches come from licensed sellers. Naturally, you should identify an authorized dealer to get a fine observe. There are numerous bogus objects all-around, so hunt for a dealer have self-confidence in. To seek out one particular, hunt for these items:

- A credit score card manufacturer's guarantee launched nicely before closing a contract - Product or service reference or 8-digit serial numbers

The reference variety of the merchandise is important. See the dealer's finish details as well as make contact with variety, handle, and man or woman get in touch with. Associates, co-workers, as well as family members generally is a useful supply of information for probable dealers. Total your dealer properly in advance of figuring out which item to get.

Choice of Watch

Your style impacts the variety of view. According to the lure or final result you'd like, the perfect observe differs. Omega watches gives a assortment for the two men and women. Try out to identify whether or not you'll utilize the watch mostly for a crucial day or for every day use. Some watches match particular occasions and can properly look notably stylish to operate with every day. Other people suit day-to-day use but are excessively straightforward for attending special occasions. Your finances and private preferences need to inform you of what collection you quite possibly can select. Based upon the assortment, expenses, and kinds likewise differ. Do not forget that watches serve to tell time. You don't just wear it for show. Looking hard enough will let you to locate a fitting and very affordable preference. Resale Worth

A watch could also be an outstanding item to resell. Merely because watches currently count as an investment, have a look at their resale value. Obtain out the valuation from the view and how significantly you'll be able to resell it to jewelers in NYC. Test how watches are valued such as selling price depreciation to search out the acceptable piece.

Bethany Webster [Author] will work with each other with offering .



Anonymous said...

[url=http://omegawatchkakaku.blogspot.jp/]オメガ 腕時計 レディース[/url]


Luxury Omega Copy

Like a lot of other luxury view manufacturers Omega was born inside a tiny shop in Switzerland and it harmoniously grown till numerous influential individuals like presidents, actors and well-liked icons chose to wear them. Even if the thought on the Omega watches started off in a modest shop it swiftly develop and became a single on the most fashionable view brand names. But all this method of improvement was also a tough one, and sadly, Omega faced extreme economic complications through the financial recession among 1975 and 1980 and needed to be bailed out in 1981. There were talks of a probable acquire out from Seiko, a competing observe manufacturer, however the innovative management, new ideas, new designs and brilliant strategies of new types and view movements managed to conquer these difficulties.


Omega is supplied inside a selection of models for both women and men satisfying in this way a large number of tastes. The solution assortment is categorized by the Constellation, Omega Seamaster, Speedmaster, Deville and Specialties. The most popular designs will be the Omega Seamaster, which incorporates the Planet Ocean, Aqua Terra and Seamaster Bond variations, as well as the Speedmaster, which incorporates the Omega Speedmaster Skilled Moon observe. The Specialties consist of Olympic collections and refer to another seasonal things.

The Omega watches are nevertheless the Hollywood with the watch empire by associated its title with one from the most widely used motion pictures. On the earth of cinematography: James Bond. Pierce Brosnan wore as an example the Omega Seamaster Quartz Experienced in GoldenEye and, in later movies, the Omega Seamaster Specialized Chronometer. The elegance of this accessory was a superb addition for the character transforming the watch itself right into a character. The diversity just isn't more than yet. In 1999, Omega unveiled their very first mass-produced watch that incorporated co-axial escapement. Escapement is known as a mechanism that converts rotational movement into an oscillating or back and forth motion (it's the "ticking" sound made by watches). From landing on Moon to James Bond, the Omega watches experienced all sorts of associations and it has also been the official timekeeper to the Olympics this currently being a signal of diversity.

Even though it has made amazing steps from landing on Moon to step into an expensive automobile near to Bond devices the Omega watches kept an air of tangibility and it virtually impossible to not desire one particular in the Omega watches.

Once you, all the same, are unable to afford to purchase genuine watch for 1000's bucks, you can easily settle for top quality .



Anonymous said...

[url=http://omegawatchkakaku.blogspot.jp/]オメガ 腕時計 レディース[/url]


Omega Watches Speedmaster Model

Omega is definitely a Swiss luxury watch producer primarily based in Bienne, Switzerland. It is actually one of the most very well recognized view producing manufacturers on the earth. Even Neil Armstrong wore 1 from the Omega watches when he to start with set his foot to the moon from the year 1969. So, it is the fist view over the moon. This timepiece is now exhibited in Washington D.Cs Nationwide Air and Area Museum.

This brand had also been the alternative of NASA astronaut, Buzz Aldrin, who was moreover the 2nd human being to set his foot on moon following Armstrong, his mission commander. In his guide, Return to Earth, Aldrin mentioned that though donating several items to your Smithsonian Institution, few of his products were stolen and his Omega view was a single of them.

Omega Speedmaster Pro Chronograph was the timepiece that was worn within the moon by both Armstrong and Aldrin. This chronograph wristwatch was also worn on moon all via Apollo 11 mission and during the initial American space stroll during Gemini four. The Speedmaster Specialized is amongst the lots of Omega watches which have met the requirements of NASA for space flight and is thought about because the only model competent by EVA.

There are many other versions which are included while in the Speedmaster assortment but no timepiece could acquire the recognition like Speedmaster Specialized of Omega. It is one particular of the longest generated Omega watches. Yet, if you're beneath an impression the Speedmaster collection was literally manufactured for space exploration, you're incorrect! The timepiece was not made initially for this function rather it had been launched while in the industry during the yr 1957 as being a racing and sports activities chronograph and this set off the place of Omega as the authorized timekeeper for Olympics.

CK 2915 was the very first model of Speedmaster. This watch was launched during the marketplace in 1957 and integrated the well-known Omega Calibre 321. Lemanias Albert Piguet created the timepiece within the yr 1946. The title Speedmaster gained inspiration in the models distinct tachymeter scale bezel that was uncovered to be a prominent characteristic within their subsequent collections. The model was introduced using the series hallmark domed Plexiglas crystal, triple-registered chronograph layout, and high-contrast, simple markers. It even applied Broadarrow handset of your brand.

The second model of this model was launched from the yr 1959 along with the newer version became common as CK 2998. It was launched with alpha hands and also a tachymeter bezel featuring black aluminum. The model underwent even further updation inside the year 1963 with straight baton hands and an uneven situation for defending the crown and chronograph pushers.

Quite a bit of stars and celebrities happen to be noticed to wear Omega watches. James Bond, the Hollywood star, is wearing the timepieces from this brand considering the yr 1995. Other celebrities that have been noticed to wear these watches include things like Prince William, John F. Kennedy, George Clooney, Joe Biden, Nicole Kidman, Stephen Colbert, Cindy Crawford and lots of many others.

Author: Michele Clark
Website: