Home : Annotations : Manipulating : Using the DefaultAnnotations collection to create annotations using JavaScript (Legacy Web Controls)
Q10172 - HOWTO: Using the DefaultAnnotations collection to create annotations using JavaScript (Legacy Web Controls)

To use the DefaultAnnotations collection in conjunction with JavaScript, you will need to make sure that the annotations you are adding to the collection are added in the Page.OnInit event during the Page life cycle.  This is necessary because  the asynchronous JavaScript requests to create annotations are executed in the Init phase of the Page life cycle.  Here is an example:

// Code-behind:
// This needs to be called after InitializeComponent() in OnInit
private void InitializeDefaultAnnotations()

   RectangleData highlighter = new RectangleData();
   highlighter.Name = "Highlighter";
   highlighter.Outline = new AnnotationPen(Color.Transparent, 1);
   highlighter.Fill = new AnnotationBrush(Color.FromArgb(128, Color.Yellow));

   WebImageViewer1.Annotations.DefaultAnnotations.Add(highlighter);
}

// JavaScript:
CreateAnnotation('RectangleData', 'Highlighter');

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2019. InstantASP Ltd. All Rights Reserved