ASP.NET AJAX :Target Properties

Extender controls are characterized by a set of properties that
determine the resulting behavior. The values of these properties are
passed on to the client and incorporated in the
client script.

Obviously, a made-to-measure framework is required both on the server
and the client to make the implementation of behaviors effective and,
more importantly, affordable. This framework is exactly the benefit
that ASP.NET AJAX Extensions provides. We'll examine the internals of
extenders in a moment while going through some sample code. Meanwhile,
let's take a quick look at how you actually use extenders in ASP.NET
pages.

In a page, you have one extender instance for each control you want to
enhance. The extender is decorated with a set of properties, as shown
here:

<act:TextBoxWatermarkExtender ID="Watermark1" runat="server"
TargetControlID="TextBox1"
WatermarkText=" ... "
WatermarkCssClass=" ... " />
</act:TextBoxWatermarkExtender>
<act:TextBoxWatermarkExtender ID="Watermark2" runat="server"
TargetControlID="TextBox2"
WatermarkText=" ... "
WatermarkCssClass=" ... " />
</act:TextBoxWatermarkExtender>

The TargetControlID property is common to all extenders and indicates
the control in the page that is the target of the extender. Other
properties specific to the extender tailor its individual behavior.
The WatermarkText and WatermarkCssClass properties are implemented
only by the Watermark Extender, for example, and serve to assign the
text and style the watermarked text should exhibit.

No comments:

Post a Comment