/
XhtmlTextWriter.xml
603 lines (527 loc) · 43.7 KB
/
XhtmlTextWriter.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
<Type Name="XhtmlTextWriter" FullName="System.Web.UI.XhtmlTextWriter">
<TypeSignature Language="C#" Value="public class XhtmlTextWriter : System.Web.UI.HtmlTextWriter" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit XhtmlTextWriter extends System.Web.UI.HtmlTextWriter" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.XhtmlTextWriter" />
<TypeSignature Language="VB.NET" Value="Public Class XhtmlTextWriter
Inherits HtmlTextWriter" />
<TypeSignature Language="F#" Value="type XhtmlTextWriter = class
 inherit HtmlTextWriter" />
<TypeSignature Language="C++ CLI" Value="public ref class XhtmlTextWriter : System::Web::UI::HtmlTextWriter" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Web.UI.HtmlTextWriter</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Writes Extensible Hypertext Markup Language (XHTML)-specific characters, including all variations of XHTML modules that derive from XHTML, to the output stream for an ASP.NET server control for mobile devices. Override the <see cref="T:System.Web.UI.XhtmlTextWriter" /> class to provide custom XHTML rendering for ASP.NET pages and server controls.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
XHTML is an XML-compliant markup language, based on HTML 4.1, which allows you to create Web sites that are suitable for multiple device types. It merges the ease of use provided by HTML with the strict element guidelines provided by XML to produce a markup language with a wide range of format and style options, and with reduced markup tag ambiguity. The <xref:System.Web.UI.XhtmlTextWriter> class provides formatting capabilities that ASP.NET server controls use when rendering XHTML content to clients. You can use the <xref:System.Web.UI.XhtmlTextWriter.SetDocType%2A> method to specify which type of XHTML the text writer renders. Supported document types are defined in the <xref:System.Web.UI.XhtmlMobileDocType> enumeration.
The <xref:System.Web.UI.XhtmlTextWriter> class renders two sets of attributes for elements. One set is a collection of common attributes, as referenced in the <xref:System.Web.UI.XhtmlTextWriter.CommonAttributes%2A> property. The second set is a collection of element-specific attributes, as referenced in the <xref:System.Web.UI.XhtmlTextWriter.ElementSpecificAttributes%2A> property. For more information on the elements and styles that are rendered, see the XHTML modularization specification at the [World Wide Web Consortium (W3C) Web site](https://go.microsoft.com/fwlink/?linkid=37125).
You can use the members of the <xref:System.Web.UI.XhtmlTextWriter> class and any derived classes to create custom text writers to use in custom XHTML page adapters or class adapters. You can also create derived classes that override the standard behavior of the <xref:System.Web.UI.XhtmlTextWriter> class.
By default, when you are working with browsers that support HTML 4.0, ASP.NET pages and controls render markup that is compatible with the XHTML 1.1 standard. For more information, see [XHTML Standards in Visual Studio and ASP.NET](https://docs.microsoft.com/previous-versions/aspnet/exc57y7e(v=vs.100)).
The <xref:System.Web.UI.HtmlTextWriter> outputs XHTML unless you configure ASP.NET specifically to not render XHTML markup. For more information, see [How to: Configure XHTML Rendering in ASP.NET Web Sites](https://docs.microsoft.com/previous-versions/aspnet/ms178159(v=vs.100)).
## Examples
The code example in this section contains four parts. The first example demonstrates how to create a derived class. The second code example demonstrates how to create a custom control. The third code example demonstrates how to use the custom control. The fourth code example provides the code that is required to run the custom control.
The following code example demonstrates how to create a custom class that is derived from the <xref:System.Web.UI.XhtmlTextWriter> class. It has two constructors, which is standard for all classes that inherit directly or indirectly from the <xref:System.Web.UI.HtmlTextWriter> class. The first constructor takes a <xref:System.IO.TextWriter> object as a parameter and calls the second constructor, passing the following two parameter values:
- The <xref:System.IO.TextWriter> instance.
- The value of the <xref:System.Web.UI.HtmlTextWriter.DefaultTabString?displayProperty=nameWithType> property, which defines the default line indentation that is used by the XHTML text writer.
This code example also shows how to override the <xref:System.Web.UI.XhtmlTextWriter.OnAttributeRender%2A> and <xref:System.Web.UI.XhtmlTextWriter.OnStyleAttributeRender%2A> methods to filter for text size and color style, respectively. Additionally, it overrides the <xref:System.Web.UI.HtmlTextWriter.BeginRender%2A> and <xref:System.Web.UI.HtmlTextWriter.EndRender%2A> methods to write a text string before and after a control has rendered.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/CS/customxhtmltextwriter.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/VB/customxhtmltextwriter.vb" id="Snippet1":::
The following code example demonstrates how to create a custom <xref:System.Web.UI.WebControls.Label> control named `TestLabel` and a custom adapter named `XhtmlTestLabelAdapter` that renders the content of the control as XHTML.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.XhtmlTextWriter_Sample1/cs/xhtmltextlabel.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.XhtmlTextWriter_Sample1/VB/xhtmltestlabel.vb" id="Snippet1":::
The following code example demonstrates how to use the custom control `TestLabel` on an ASP.NET Web page.
:::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.XhtmlTextWriter_Sample1/cs/xhtmltextlabel.aspx" id="Snippet4":::
:::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.XhtmlTextWriter_Sample1/VB/xhtmltestlabel.aspx" id="Snippet4":::
To use the custom control in the preceding code example, add the following `<controlAdapters>` element to one of two files. You can add it to the appropriate machine-wide file in the subdirectory for a specific browser, as a subfolder of the .NET Framework configuration directory. Alternatively, you can add it to a custom browser file in the App_Browsers directory under the Web application root.
```
<controlAdapters>
<adapter controlType="AspNet.Samples.TestLabel"
adapterType="AspNet.Samples.XhtmlTestLabelAdapter" />
</controlAdapters>
```
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.ChtmlTextWriter" />
<related type="Article" href="https://docs.microsoft.com/previous-versions/aspnet/exc57y7e(v=vs.100)">ASP.NET and XHTML Compliance</related>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.XhtmlTextWriter" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XhtmlTextWriter (System.IO.TextWriter writer);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.IO.TextWriter writer) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.XhtmlTextWriter.#ctor(System.IO.TextWriter)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (writer As TextWriter)" />
<MemberSignature Language="F#" Value="new System.Web.UI.XhtmlTextWriter : System.IO.TextWriter -> System.Web.UI.XhtmlTextWriter" Usage="new System.Web.UI.XhtmlTextWriter writer" />
<MemberSignature Language="C++ CLI" Value="public:
 XhtmlTextWriter(System::IO::TextWriter ^ writer);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="writer" Type="System.IO.TextWriter" />
</Parameters>
<Docs>
<param name="writer">A <see cref="T:System.IO.TextWriter" /> instance that renders the XHTML content.</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.XhtmlTextWriter" /> class that uses the line indentation that is specified in the <see cref="F:System.Web.UI.HtmlTextWriter.DefaultTabString" /> field. Use the <see cref="M:System.Web.UI.XhtmlTextWriter.#ctor(System.IO.TextWriter)" /> constructor if you do not want to change the default line indentation.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.XhtmlTextWriter.%23ctor%2A> constructor that takes a <xref:System.IO.TextWriter> object as a parameter calls the second constructor, passing two parameter values:
- The <xref:System.IO.TextWriter> instance.
- The string value that is specified in the <xref:System.Web.UI.HtmlTextWriter.DefaultTabString> field, which defines the tab spacing that is used by the XHTML text writer.
## Examples
The following code example demonstrates how to create the two constructors, which is standard for all classes that derive directly or indirectly from the <xref:System.Web.UI.HtmlTextWriter> class, for a custom class that is derived from the <xref:System.Web.UI.XhtmlTextWriter> class.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/CS/customxhtmltextwriter.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/VB/customxhtmltextwriter.vb" id="Snippet5":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public XhtmlTextWriter (System.IO.TextWriter writer, string tabString);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.IO.TextWriter writer, string tabString) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.XhtmlTextWriter.#ctor(System.IO.TextWriter,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (writer As TextWriter, tabString As String)" />
<MemberSignature Language="F#" Value="new System.Web.UI.XhtmlTextWriter : System.IO.TextWriter * string -> System.Web.UI.XhtmlTextWriter" Usage="new System.Web.UI.XhtmlTextWriter (writer, tabString)" />
<MemberSignature Language="C++ CLI" Value="public:
 XhtmlTextWriter(System::IO::TextWriter ^ writer, System::String ^ tabString);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="writer" Type="System.IO.TextWriter" />
<Parameter Name="tabString" Type="System.String" />
</Parameters>
<Docs>
<param name="writer">A <see cref="T:System.IO.TextWriter" /> instance that renders the XHTML content.</param>
<param name="tabString">The string used to render a line indentation.</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.XhtmlTextWriter" /> class with the specified line indentation.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example demonstrates how to create the two constructors, which is standard for all classes that derive directly or indirectly from the <xref:System.Web.UI.HtmlTextWriter> class, for a custom class that is derived from the <xref:System.Web.UI.XhtmlTextWriter> class.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/CS/customxhtmltextwriter.cs" id="Snippet5":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/VB/customxhtmltextwriter.vb" id="Snippet5":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="AddRecognizedAttribute">
<MemberSignature Language="C#" Value="public virtual void AddRecognizedAttribute (string elementName, string attributeName);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void AddRecognizedAttribute(string elementName, string attributeName) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.XhtmlTextWriter.AddRecognizedAttribute(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub AddRecognizedAttribute (elementName As String, attributeName As String)" />
<MemberSignature Language="F#" Value="abstract member AddRecognizedAttribute : string * string -> unit
override this.AddRecognizedAttribute : string * string -> unit" Usage="xhtmlTextWriter.AddRecognizedAttribute (elementName, attributeName)" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual void AddRecognizedAttribute(System::String ^ elementName, System::String ^ attributeName);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="elementName" Type="System.String" />
<Parameter Name="attributeName" Type="System.String" />
</Parameters>
<Docs>
<param name="elementName">The XHTML element to add the attribute to.</param>
<param name="attributeName">The attribute to add.</param>
<summary>Adds an attribute to an XHTML element. The collection of element-specific attributes for the <see cref="T:System.Web.UI.XhtmlTextWriter" /> object is referenced by the <see cref="P:System.Web.UI.XhtmlTextWriter.ElementSpecificAttributes" /> property.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.XhtmlTextWriter.AddRecognizedAttribute%2A> method to add an attribute to an XHTML element. The added attribute can then be recognized and rendered by the <xref:System.Web.UI.XhtmlTextWriter> object. To prevent the writer from rendering a common attribute of an XHTML element, use the <xref:System.Web.UI.XhtmlTextWriter.RemoveRecognizedAttribute%2A> method.
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.XhtmlTextWriter.ElementSpecificAttributes" />
<altmember cref="M:System.Web.UI.XhtmlTextWriter.RemoveRecognizedAttribute(System.String,System.String)" />
</Docs>
</Member>
<Member MemberName="CommonAttributes">
<MemberSignature Language="C#" Value="protected System.Collections.Hashtable CommonAttributes { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Hashtable CommonAttributes" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.XhtmlTextWriter.CommonAttributes" />
<MemberSignature Language="VB.NET" Value="Protected ReadOnly Property CommonAttributes As Hashtable" />
<MemberSignature Language="F#" Value="member this.CommonAttributes : System.Collections.Hashtable" Usage="System.Web.UI.XhtmlTextWriter.CommonAttributes" />
<MemberSignature Language="C++ CLI" Value="protected:
 property System::Collections::Hashtable ^ CommonAttributes { System::Collections::Hashtable ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Collections.Hashtable</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a <see cref="T:System.Collections.Hashtable" /> object containing common attributes of the markup tags for the <see cref="T:System.Web.UI.XhtmlTextWriter" /> object.</summary>
<value>A <see cref="T:System.Collections.Hashtable" /> object containing common attributes.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.XhtmlTextWriter.CommonAttributes%2A> collection contains attributes that are allowed in XHTML elements and that are not suppressed in the <xref:System.Web.UI.XhtmlTextWriter.SuppressCommonAttributes%2A> property. For more information on common attributes, see the [World Wide Web Consortium (W3C) Web site](https://go.microsoft.com/fwlink/?linkid=37125).
When a new instance of the <xref:System.Web.UI.XhtmlTextWriter> class is created, the common attributes that are initialized are:
- `class`
- `id`
- `title`
- `xml:lang`
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.XhtmlTextWriter.SuppressCommonAttributes" />
<altmember cref="P:System.Web.UI.XhtmlTextWriter.ElementSpecificAttributes" />
</Docs>
</Member>
<Member MemberName="ElementSpecificAttributes">
<MemberSignature Language="C#" Value="protected System.Collections.Hashtable ElementSpecificAttributes { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Hashtable ElementSpecificAttributes" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.XhtmlTextWriter.ElementSpecificAttributes" />
<MemberSignature Language="VB.NET" Value="Protected ReadOnly Property ElementSpecificAttributes As Hashtable" />
<MemberSignature Language="F#" Value="member this.ElementSpecificAttributes : System.Collections.Hashtable" Usage="System.Web.UI.XhtmlTextWriter.ElementSpecificAttributes" />
<MemberSignature Language="C++ CLI" Value="protected:
 property System::Collections::Hashtable ^ ElementSpecificAttributes { System::Collections::Hashtable ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Collections.Hashtable</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a <see cref="T:System.Collections.Hashtable" /> object containing element-specific attributes.</summary>
<value>A <see cref="T:System.Collections.Hashtable" /> object containing element-specific attributes.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.XhtmlTextWriter.AddRecognizedAttribute%2A> method to add recognized attributes to an XHTML element. To remove common attributes on an XHTML element, use the <xref:System.Web.UI.XhtmlTextWriter.RemoveRecognizedAttribute%2A> method.
When a new instance of the <xref:System.Web.UI.XhtmlTextWriter> class is created, the <xref:System.Collections.Hashtable> object of element-specific attributes is populated with the attributes shown in the following table.
|Element|Attributes|
|-------------|----------------|
|`<a>`|`accesskey`, `href`, `charset`, `hreflang`, `rel`, `type`, `rev`, `title`, `tabindex`|
|`<base>`|`href`|
|`<blockquote>`|`cite`|
|`<br>`|`id`, `class`, `title`|
|`<form>`|`action`, `method`, `enctype`|
|`<head>`|`xml:lang`|
|`<html>`|`version`, `xml:lang`, `xmlns`|
|`<img>`|`src`, `alt`, `width`, `longdesc`, `height`|
|`<input>`|`size`, `accesskey`, `title`, `name`, `type`, `disabled`, `value`, `src`, `checked`, `maxlength`, `tabindex`|
|`<label>`|`accesskey`, `for`|
|`<li>`|`value`|
|`<link>`|`hreflang`, `rev`, `type`, `charset`, `rel`, `href`, `media`|
|`<meta>`|`content`, `name`, `xml:lang`, `http-equiv`, `scheme`|
|`<object>`|`codebase`, `classid`, `data`, `standby`, `name`, `type`, `height`, `archive`, `declare`, `width`, `tabindex`, `codetype`|
|`<ol>`|`start`|
|`<optgroup>`|`label`, `disabled`|
|`<option>`|`selected`, `value`|
|`<param>`|`id`, `name`, `valuetype`, `value`, `type`|
|`<pre>`|`xml:space`|
|`<q>`|`cite`|
|`<select>`|`name`, `tabindex`, `disabled`, `multiple`, `size`|
|`<style>`|`xml:lang`, `xml:space`, `type`, `title`, `media`|
|`<table>`|`width`, `summary`|
|`<textarea>`|`name`, `cols`, `accesskey`, `tabindex`, `rows`|
|`<td>`|`headers`, `align`, `rowspan`, `colspan`, `axis`, `scope`, `abbr`, `valign`|
|`<th>`|`headers`, `align`, `rowspan`, `colspan`, `axis`, `scope`, `abbr`, `valign`|
|`<title>`|`xml:lang`|
|`<tr>`|`align`, `valign`|
For more information on the elements and styles that are rendered, see the XHTML modularization specification at the [World Wide Web Consortium (W3C) Web site](https://go.microsoft.com/fwlink/?linkid=37125).
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.XhtmlTextWriter.CommonAttributes" />
<altmember cref="P:System.Web.UI.XhtmlTextWriter.SuppressCommonAttributes" />
<altmember cref="M:System.Web.UI.XhtmlTextWriter.AddRecognizedAttribute(System.String,System.String)" />
<altmember cref="M:System.Web.UI.XhtmlTextWriter.RemoveRecognizedAttribute(System.String,System.String)" />
</Docs>
</Member>
<Member MemberName="IsValidFormAttribute">
<MemberSignature Language="C#" Value="public override bool IsValidFormAttribute (string attributeName);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance bool IsValidFormAttribute(string attributeName) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.XhtmlTextWriter.IsValidFormAttribute(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function IsValidFormAttribute (attributeName As String) As Boolean" />
<MemberSignature Language="F#" Value="override this.IsValidFormAttribute : string -> bool" Usage="xhtmlTextWriter.IsValidFormAttribute attributeName" />
<MemberSignature Language="C++ CLI" Value="public:
 override bool IsValidFormAttribute(System::String ^ attributeName);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="attributeName" Type="System.String" />
</Parameters>
<Docs>
<param name="attributeName">The attribute name to check.</param>
<summary>Checks an XHTML attribute to ensure that it can be rendered in the opening tag of a <see langword="<form>" /> element.</summary>
<returns>
<see langword="true" /> if the attribute can be applied to a <see langword="<form>" /> element; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is useful to conditionally render an attribute depending on whether it is supported by the XHTML document type of the requesting device.
## Examples
The following code example is part of a larger example that creates a custom <xref:System.Web.UI.WebControls.Label> control and an adapter that renders the content of the control as XHTML.
This code example demonstrates how to create a Boolean variable named `attTest` and set it to the return value that results from calling the <xref:System.Web.UI.XhtmlTextWriter.IsValidFormAttribute%2A> method with the parameter value "style". If the <xref:System.Web.UI.XhtmlTextWriter.IsValidFormAttribute%2A> method returns `true`, the styles that are associated with the control are rendered using the <xref:System.Web.UI.HtmlTextWriter.EnterStyle%2A?displayProperty=nameWithType> and <xref:System.Web.UI.HtmlTextWriter.ExitStyle%2A?displayProperty=nameWithType> methods. If the `attTest` value is `false`, the styles are not rendered. Instead, the page displays the text for the control, a `<br/>` element that is rendered by the <xref:System.Web.UI.XhtmlTextWriter.WriteBreak%2A> method, and a text string informing the user that the XHTML content of the control has rendered conditionally.
This code example is part of a larger example provided for the <xref:System.Web.UI.XhtmlTextWriter> class.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.XhtmlTextWriter_Sample1/cs/xhtmltextlabel.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.XhtmlTextWriter_Sample1/VB/xhtmltestlabel.vb" id="Snippet3":::
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="OnAttributeRender">
<MemberSignature Language="C#" Value="protected override bool OnAttributeRender (string name, string value, System.Web.UI.HtmlTextWriterAttribute key);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance bool OnAttributeRender(string name, string value, valuetype System.Web.UI.HtmlTextWriterAttribute key) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.XhtmlTextWriter.OnAttributeRender(System.String,System.String,System.Web.UI.HtmlTextWriterAttribute)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function OnAttributeRender (name As String, value As String, key As HtmlTextWriterAttribute) As Boolean" />
<MemberSignature Language="F#" Value="override this.OnAttributeRender : string * string * System.Web.UI.HtmlTextWriterAttribute -> bool" Usage="xhtmlTextWriter.OnAttributeRender (name, value, key)" />
<MemberSignature Language="C++ CLI" Value="protected:
 override bool OnAttributeRender(System::String ^ name, System::String ^ value, System::Web::UI::HtmlTextWriterAttribute key);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="value" Type="System.String" />
<Parameter Name="key" Type="System.Web.UI.HtmlTextWriterAttribute" />
</Parameters>
<Docs>
<param name="name">The XHTML attribute to render.</param>
<param name="value">The value assigned to the XHTML attribute.</param>
<param name="key">The <see cref="T:System.Web.UI.HtmlTextWriterAttribute" /> enumeration value associated with the XHTML attribute.</param>
<summary>Determines whether the specified XHTML attribute and its value can be rendered to the current markup element.</summary>
<returns>
<see langword="true" /> if the attribute is rendered to the page; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example demonstrates how to override the <xref:System.Web.UI.XhtmlTextWriter.OnAttributeRender%2A> method to check whether a `size` attribute is rendered for any of the elements that are rendered by this text writer. If a `size` attribute is rendered, the code checks whether its value is 8 point. If so, the <xref:System.Web.UI.XhtmlTextWriter.OnAttributeRender%2A> method returns `true`, allowing the attribute and its value to render. If the value is other than 8 point, the <xref:System.Web.UI.XhtmlTextWriter.OnAttributeRender%2A> method returns `false`, and the attribute and its value are not rendered. If the key parameter of the <xref:System.Web.UI.XhtmlTextWriter.OnAttributeRender%2A> method does not match the <xref:System.Web.UI.HtmlTextWriterAttribute.Size> attribute, the base functionality of the <xref:System.Web.UI.XhtmlTextWriter.OnAttributeRender%2A> method is called, as defined in the <xref:System.Web.UI.XhtmlTextWriter> class.
This code example is part of a larger example provided for the <xref:System.Web.UI.XhtmlTextWriter> class.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/CS/customxhtmltextwriter.cs" id="Snippet2":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/VB/customxhtmltextwriter.vb" id="Snippet2":::
]]></format>
</remarks>
<altmember cref="M:System.Web.UI.XhtmlTextWriter.OnStyleAttributeRender(System.String,System.String,System.Web.UI.HtmlTextWriterStyle)" />
</Docs>
</Member>
<Member MemberName="OnStyleAttributeRender">
<MemberSignature Language="C#" Value="protected override bool OnStyleAttributeRender (string name, string value, System.Web.UI.HtmlTextWriterStyle key);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance bool OnStyleAttributeRender(string name, string value, valuetype System.Web.UI.HtmlTextWriterStyle key) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.XhtmlTextWriter.OnStyleAttributeRender(System.String,System.String,System.Web.UI.HtmlTextWriterStyle)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function OnStyleAttributeRender (name As String, value As String, key As HtmlTextWriterStyle) As Boolean" />
<MemberSignature Language="F#" Value="override this.OnStyleAttributeRender : string * string * System.Web.UI.HtmlTextWriterStyle -> bool" Usage="xhtmlTextWriter.OnStyleAttributeRender (name, value, key)" />
<MemberSignature Language="C++ CLI" Value="protected:
 override bool OnStyleAttributeRender(System::String ^ name, System::String ^ value, System::Web::UI::HtmlTextWriterStyle key);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="name" Type="System.String" />
<Parameter Name="value" Type="System.String" />
<Parameter Name="key" Type="System.Web.UI.HtmlTextWriterStyle" />
</Parameters>
<Docs>
<param name="name">The XHTML style attribute to render.</param>
<param name="value">The value assigned to the XHTML style attribute.</param>
<param name="key">The <see cref="T:System.Web.UI.HtmlTextWriterStyle" /> enumeration value associated with the XHTML style attribute.</param>
<summary>Determines whether the specified XHTML style attribute and its value can be rendered to the current markup element.</summary>
<returns>
<see langword="true" /> if the style attribute is rendered; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example demonstrates how to override the <xref:System.Web.UI.XhtmlTextWriter.OnStyleAttributeRender%2A> method to check whether a <xref:System.Web.UI.HtmlTextWriterStyle.Color> attribute is being rendered for any of the elements that are rendered by this text writer. If a <xref:System.Web.UI.HtmlTextWriterStyle.Color> attribute is rendered, the code checks whether its value is purple. If the value is purple, the <xref:System.Web.UI.XhtmlTextWriter.OnStyleAttributeRender%2A> method returns `false` and the attribute and its value are not rendered. If the <xref:System.Web.UI.HtmlTextWriterStyle.Color> attribute is set to any other value, the <xref:System.Web.UI.XhtmlTextWriter.OnStyleAttributeRender%2A> method returns `true` and the attribute and its value are rendered. If the key parameter of the <xref:System.Web.UI.XhtmlTextWriter.OnAttributeRender%2A> method does not match the <xref:System.Web.UI.HtmlTextWriterStyle.Color> attribute, the base functionality of the <xref:System.Web.UI.XhtmlTextWriter.OnStyleAttributeRender%2A> method is called, as defined in the <xref:System.Web.UI.XhtmlTextWriter> class.
This code example is part of a larger example provided for the <xref:System.Web.UI.XhtmlTextWriter> class.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/CS/customxhtmltextwriter.cs" id="Snippet3":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/VB/customxhtmltextwriter.vb" id="Snippet3":::
]]></format>
</remarks>
<altmember cref="M:System.Web.UI.XhtmlTextWriter.OnAttributeRender(System.String,System.String,System.Web.UI.HtmlTextWriterAttribute)" />
</Docs>
</Member>
<Member MemberName="RemoveRecognizedAttribute">
<MemberSignature Language="C#" Value="public virtual void RemoveRecognizedAttribute (string elementName, string attributeName);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void RemoveRecognizedAttribute(string elementName, string attributeName) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.XhtmlTextWriter.RemoveRecognizedAttribute(System.String,System.String)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub RemoveRecognizedAttribute (elementName As String, attributeName As String)" />
<MemberSignature Language="F#" Value="abstract member RemoveRecognizedAttribute : string * string -> unit
override this.RemoveRecognizedAttribute : string * string -> unit" Usage="xhtmlTextWriter.RemoveRecognizedAttribute (elementName, attributeName)" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual void RemoveRecognizedAttribute(System::String ^ elementName, System::String ^ attributeName);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="elementName" Type="System.String" />
<Parameter Name="attributeName" Type="System.String" />
</Parameters>
<Docs>
<param name="elementName">The XHTML element to remove an attribute from.</param>
<param name="attributeName">The attribute to remove from the specified XHTML element.</param>
<summary>Removes an attribute from the <see cref="P:System.Web.UI.XhtmlTextWriter.ElementSpecificAttributes" /> collection of an element.</summary>
<remarks>To be added.</remarks>
<altmember cref="P:System.Web.UI.XhtmlTextWriter.ElementSpecificAttributes" />
<altmember cref="M:System.Web.UI.XhtmlTextWriter.AddRecognizedAttribute(System.String,System.String)" />
</Docs>
</Member>
<Member MemberName="SetDocType">
<MemberSignature Language="C#" Value="public virtual void SetDocType (System.Web.UI.XhtmlMobileDocType docType);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void SetDocType(valuetype System.Web.UI.XhtmlMobileDocType docType) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.XhtmlTextWriter.SetDocType(System.Web.UI.XhtmlMobileDocType)" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub SetDocType (docType As XhtmlMobileDocType)" />
<MemberSignature Language="F#" Value="abstract member SetDocType : System.Web.UI.XhtmlMobileDocType -> unit
override this.SetDocType : System.Web.UI.XhtmlMobileDocType -> unit" Usage="xhtmlTextWriter.SetDocType docType" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual void SetDocType(System::Web::UI::XhtmlMobileDocType docType);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="docType" Type="System.Web.UI.XhtmlMobileDocType" />
</Parameters>
<Docs>
<param name="docType">One of the <see cref="T:System.Web.UI.XhtmlMobileDocType" /> enumeration values.</param>
<summary>Specifies the XHTML document type for the text writer to render to the page or control.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Web.UI.XhtmlTextWriter.SetDocType%2A> method in a custom page adapter to define the type of XHTML that you want to render to the requesting device. Supported document types are defined in the <xref:System.Web.UI.XhtmlMobileDocType> enumeration.
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.XhtmlMobileDocType" />
</Docs>
</Member>
<Member MemberName="SuppressCommonAttributes">
<MemberSignature Language="C#" Value="protected System.Collections.Hashtable SuppressCommonAttributes { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.Hashtable SuppressCommonAttributes" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.XhtmlTextWriter.SuppressCommonAttributes" />
<MemberSignature Language="VB.NET" Value="Protected ReadOnly Property SuppressCommonAttributes As Hashtable" />
<MemberSignature Language="F#" Value="member this.SuppressCommonAttributes : System.Collections.Hashtable" Usage="System.Web.UI.XhtmlTextWriter.SuppressCommonAttributes" />
<MemberSignature Language="C++ CLI" Value="protected:
 property System::Collections::Hashtable ^ SuppressCommonAttributes { System::Collections::Hashtable ^ get(); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Collections.Hashtable</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a <see cref="T:System.Collections.Hashtable" /> object of elements for which <see cref="P:System.Web.UI.XhtmlTextWriter.CommonAttributes" /> attributes are suppressed.</summary>
<value>A <see cref="T:System.Collections.Hashtable" /> of elements containing a collection of <see cref="P:System.Web.UI.XhtmlTextWriter.CommonAttributes" /> that are not rendered.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The suppressed attribute collection includes a list of XHTML elements for which <xref:System.Web.UI.XhtmlTextWriter.CommonAttributes%2A> attributes are not rendered.
When a new instance of the <xref:System.Web.UI.XhtmlTextWriter> class is created, the <xref:System.Collections.Hashtable> object of elements for which <xref:System.Web.UI.XhtmlTextWriter.CommonAttributes%2A> attributes are suppressed includes:
- `base`
- `meta`
- `br`
- `head`
- `title`
- `html`
- `style`
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.XhtmlTextWriter.CommonAttributes" />
<altmember cref="P:System.Web.UI.XhtmlTextWriter.ElementSpecificAttributes" />
</Docs>
</Member>
<Member MemberName="WriteBreak">
<MemberSignature Language="C#" Value="public override void WriteBreak ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance void WriteBreak() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.XhtmlTextWriter.WriteBreak" />
<MemberSignature Language="VB.NET" Value="Public Overrides Sub WriteBreak ()" />
<MemberSignature Language="F#" Value="override this.WriteBreak : unit -> unit" Usage="xhtmlTextWriter.WriteBreak " />
<MemberSignature Language="C++ CLI" Value="public:
 override void WriteBreak();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Writes a <see langword="<br/>" /> element to the XHTML output stream.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Examples
The following code example demonstrates how to override the inherited <xref:System.Web.UI.HtmlTextWriter.BeginRender%2A?displayProperty=nameWithType> method to write a text string with the <xref:System.Web.UI.HtmlTextWriter.Write%2A?displayProperty=nameWithType> method and a `<br/>` element with the <xref:System.Web.UI.XhtmlTextWriter.WriteBreak%2A> method.
:::code language="csharp" source="~/snippets/csharp/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/CS/customxhtmltextwriter.cs" id="Snippet4":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/system.web.ui.xhtmltextwriter_Sample2/VB/customxhtmltextwriter.vb" id="Snippet4":::
]]></format>
</remarks>
</Docs>
</Member>
</Members>
</Type>