-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRenderMenuExtension.cs
More file actions
36 lines (34 loc) · 1.48 KB
/
RenderMenuExtension.cs
File metadata and controls
36 lines (34 loc) · 1.48 KB
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
namespace Constellation.Html
{
using System.Diagnostics.CodeAnalysis;
using System.Web.UI;
/// <summary>
/// Extension to make working with HtmlTextWriter easier.
/// </summary>
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", Justification = "HTML Tags are not English, FX Cop. Stop correcting my spelling.")]
public static class RenderMenuExtension
{
/// <summary>
/// Creates a Menu HTML tag and adds any provided attributes to the tag.
/// </summary>
/// <param name="writer">The HTMLTextWriter.</param>
/// <param name="id">The value of the id attribute.</param>
/// <param name="cssClass">The value of the class attribute.</param>
/// <returns>Div HTML tag with attributes.</returns>
[SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Justification = "Welcome to .NET 4.0 FX Cop.")]
public static HtmlTag RenderMenu(this HtmlTextWriter writer, string id = null, string cssClass = null)
{
return writer.RenderTag("menu", id, cssClass);
}
/// <summary>
/// Creates a Menu HTML tag and adds any provided attributes to the tag.
/// </summary>
/// <param name="writer">The HTMLTextWriter.</param>
/// <param name="attributes">HTML attributes.</param>
/// <returns>Div HTML tag with attributes.</returns>
public static HtmlTag RenderMenu(this HtmlTextWriter writer, params HtmlAttribute[] attributes)
{
return new HtmlTag(writer, "menu", attributes);
}
}
}