1 //------------------------------------------------------------------------------
2 // <copyright file="HtmlSource.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //------------------------------------------------------------------------------
6 
7 namespace System.Web.UI.HtmlControls {
8     using System.ComponentModel;
9     using System.Web;
10     using System.Web.UI;
11 
12     /// <devdoc>
13     ///    <para>
14     ///       The <see langword='HtmlSource'/>
15     ///       class defines the methods, properties, and events
16     ///       for the HtmlSource server control.
17     ///       This class provides programmatic access on the server to
18     ///       the HTML 5 &lt;Source&gt; element.
19     ///    </para>
20     /// </devdoc>
21     [
22     ControlBuilderAttribute(typeof(HtmlEmptyTagControlBuilder))
23     ]
24     public class HtmlSource : HtmlControl {
25 
26         /// <devdoc>
27         /// <para>Initializes a new instance of the <see cref='System.Web.UI.HtmlControls.HtmlSource'/> class.</para>
28         /// </devdoc>
HtmlSource()29         public HtmlSource()
30             : base("source") {
31         }
32 
33         /// <devdoc>
34         ///    <para>
35         ///       Gets or sets the name of and path to the video file to be displayed. This can be an absolute or relative path.
36         ///    </para>
37         /// </devdoc>
38         [
39         WebCategory("Behavior"),
40         DefaultValue(""),
41         DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden),
42         UrlProperty()
43         ]
44         public string Src {
45             get {
46                 string s = Attributes["src"];
47                 return s ?? String.Empty;
48             }
49             set {
50                 Attributes["src"] = MapStringAttributeToString(value);
51             }
52         }
53 
54         /*
55          * Override to process src attribute
56          */
RenderAttributes(HtmlTextWriter writer)57         protected override void RenderAttributes(HtmlTextWriter writer) {
58             PreProcessRelativeReferenceAttribute(writer, "src");
59             base.RenderAttributes(writer);
60             writer.Write(" /");
61         }
62     }
63 }
64