本文整理汇总了C#中HtmlTextWriter.WriteEndTag方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriter.WriteEndTag方法的具体用法?C# HtmlTextWriter.WriteEndTag怎么用?C# HtmlTextWriter.WriteEndTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.WriteEndTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderSiteMapNode
private void RenderSiteMapNode(HtmlTextWriter writer, SiteMapPath path, SiteMapNode node)
{
writer.WriteBeginTag("a");
if(node.Url != "")
writer.WriteAttribute("href", node.Url);
if (node.Description != "")
writer.WriteAttribute("title", node.Description);
writer.Write(HtmlTextWriter.TagRightChar);
writer.Write(node.Title);
writer.WriteEndTag("a");
}
示例2: RenderNodes
private void RenderNodes(HtmlTextWriter writer, TreeNodeCollection children)
{
writer.Indent++;
foreach (TreeNode subnode in children)
{
writer.WriteLine();
writer.WriteBeginTag("li");
writer.Write(HtmlTextWriter.TagRightChar);
if (subnode.NavigateUrl != null)
{
writer.WriteBeginTag("a");
if(subnode.NavigateUrl != "")
writer.WriteAttribute("href", subnode.NavigateUrl);
if(subnode.ToolTip != "")
writer.WriteAttribute("title", subnode.ToolTip);
writer.Write(">");
writer.Write(subnode.Text);
writer.WriteEndTag("a");
}
writer.WriteEndTag("li");
if (subnode.ChildNodes.Count != 0)
{
writer.WriteLine();
writer.WriteBeginTag("ul");
writer.WriteAttribute("class", "TreeViewSubmenu");
writer.Write(HtmlTextWriter.TagRightChar);
RenderNodes(writer, subnode.ChildNodes);
writer.WriteEndTag("ul");
}
}
writer.Indent--;
writer.WriteLine();
}
示例3: RenderEndTag
protected override void RenderEndTag (HtmlTextWriter writer)
{
if (Count == 0)
writer.WriteLine ();
writer.WriteEndTag (TagName);
if (writer.Indent == 0)
writer.WriteLine ();
}
示例4: RenderChildren
override void RenderChildren (HtmlTextWriter w)
{
base.RenderChildren (w);
if (items == null) {
return;
}
w.WriteLine ();
bool done_sel = false;
int count = items.Count;
for (int i = 0; i < count; i++) {
ListItem item = items[i];
w.Indent++;
/* Write the <option> elements this
* way so that the output HTML matches
* the ms version (can't make
* HtmlTextWriterTag.Option an inline
* element, cos that breaks other
* stuff.)
*/
w.WriteBeginTag ("option");
if (item.Selected && !done_sel) {
w.WriteAttribute ("selected", "selected");
if (!Multiple) {
done_sel = true;
}
}
w.WriteAttribute ("value", item.Value, true);
w.Write (HtmlTextWriter.TagRightChar);
w.Write (HttpUtility.HtmlEncode(item.Text));
w.WriteEndTag ("option");
w.WriteLine ();
w.Indent--;
}
}
示例5: HandleError
/// <include file='doc\WmlPageAdapter.uex' path='docs/doc[@for="WmlPageAdapter.HandleError"]/*' />
public virtual bool HandleError(Exception e, HtmlTextWriter writer)
{
WmlMobileTextWriter wmlWriter = (WmlMobileTextWriter)writer;
bool renderBackButton = Device.NumberOfSoftkeys > 2 && !Device.HasBackButton;
// set mime type, in case init() has not been called yet
Page.Response.ContentType = _contentType;
Exception ex;
if ((e is HttpException && e.InnerException != null) ||
(e is System.Reflection.TargetInvocationException && e.InnerException != null))
{
ex = e.InnerException;
}
else
{
ex = e;
}
if (RequiresUTF8ContentEncoding())
{
Page.Response.ContentEncoding = UTF8Encoding;
}
wmlWriter.BeginResponse();
wmlWriter.BeginFile(Page.Request.Url.ToString(), _contentType, Page.Response.Charset);
RenderXmlHeader(writer);
// First card.
writer.WriteFullBeginTag("wml");
if (Device.SupportsCacheControlMetaTag)
{
writer.Write(_cacheExpiry);
}
else
{
Page.Response.AppendHeader("Cache-Control", "max-age=0");
}
writer.WriteFullBeginTag("card");
writer.WriteFullBeginTag("p");
writer.WriteFullBeginTag("big");
writer.WriteFullBeginTag("b");
wmlWriter.WriteEncodedText(SR.GetString(SR.WmlPageAdapterServerError,
HttpRuntime.AppDomainAppVirtualPath));
writer.WriteEndTag("b");
writer.WriteEndTag("big");
writer.WriteEndTag("p");
writer.WriteFullBeginTag("p");
writer.Write("<do type=\"accept\" label=\"");
writer.Write(GetDefaultLabel(MoreLabel));
writer.Write("\"><go href=\"#more\" /></do>");
if (renderBackButton)
{
writer.Write("<do type=\"prev\" label=\"");
writer.Write(GetDefaultLabel(BackLabel));
writer.WriteLine("\"><prev /></do>");
}
wmlWriter.WriteEncodedText(ex.GetType().ToString());
writer.Write("<br />");
wmlWriter.WriteEncodedText(ex.Message);
writer.Write("<br />");
wmlWriter.WriteEncodedText(SR.GetString(SR.WmlPageAdapterMethod));
if (ex.TargetSite != null) {
wmlWriter.WriteEncodedText(ex.TargetSite.Name);
}
writer.Write("<br />");
writer.WriteEndTag("p");
writer.WriteEndTag("card");
// Stack trace card.
writer.Write("<card id=\"more\">");
writer.Write("<p mode=\"nowrap\">");
if (renderBackButton)
{
writer.Write("<do type=\"prev\" label=\"");
wmlWriter.WriteEncodedText(GetDefaultLabel(BackLabel));
writer.WriteLine("\"><prev /></do>");
}
String stackTrace = ex.StackTrace;
if (stackTrace != null) {
int maximumStackTrace = OptimumPageWeight / 2;
if (stackTrace.Length > maximumStackTrace)
{
wmlWriter.WriteEncodedText(SR.GetString(SR.WmlPageAdapterStackTrace));
writer.Write("<br />");
stackTrace = stackTrace.Substring(0, maximumStackTrace);
}
else
//.........这里部分代码省略.........
示例6: RenderContents
protected internal override void RenderContents (HtmlTextWriter writer)
{
bool selected = false;
Page page = Page;
for (int i = 0; i < Items.Count; i++) {
ListItem item = Items [i];
if (page != null)
page.ClientScript.RegisterForEventValidation (UniqueID, item.Value);
writer.WriteBeginTag ("option");
if (item.Selected) {
if (selected)
VerifyMultiSelect ();
writer.WriteAttribute ("selected", "selected", false);
selected = true;
}
writer.WriteAttribute ("value", item.Value, true);
if (item.HasAttributes)
item.Attributes.Render (writer);
writer.Write (">");
string encoded = HttpUtility.HtmlEncode (item.Text);
writer.Write (encoded);
writer.WriteEndTag ("option");
writer.WriteLine ();
}
}
示例7: Render
protected override void Render(HtmlTextWriter writer)
{
// Render control as a div with ID (to ensure IPostBackEventHandler works in UpdatePanel)
writer.WriteBeginTag("div");
writer.WriteAttribute("id", ClientID);
writer.Write(HtmlTextWriter.TagRightChar);
base.Render(writer);
writer.WriteEndTag("div");
}
示例8: RenderEndTag
protected override void RenderEndTag(HtmlTextWriter writer)
{
writer.WriteEndTag("ul");
}
示例9: RenderListItem
private void RenderListItem(ListItem item, HtmlTextWriter writer)
{
writer.WriteBeginTag("option");
writer.WriteAttribute("value", item.Value, true);
if (item.Selected)
{
writer.WriteAttribute("selected", "selected", false);
}
foreach (string key in item.Attributes.Keys)
{
writer.WriteAttribute(key, item.Attributes[key]);
}
writer.Write(HtmlTextWriter.TagRightChar);
HttpUtility.HtmlEncode(item.Text, writer);
writer.WriteEndTag("option");
writer.WriteLine();
}
示例10: RenderOptionGroupEndTag
private void RenderOptionGroupEndTag(HtmlTextWriter writer)
{
writer.WriteEndTag("optgroup");
writer.WriteLine();
}
示例11: RenderEndTag
protected override void RenderEndTag (HtmlTextWriter writer)
{
writer.WriteLine ();
writer.WriteEndTag (TagName);
writer.WriteLine ();
}
示例12: WriteOptions
private void WriteOptions(HtmlTextWriter writer, List<GroupedListItem> groupedListItems)
{
foreach (GroupedListItem gli in groupedListItems) {
writer.WriteBeginTag("option");
writer.WriteAttribute("value", GetReferenceKey(gli)); // writer.WriteAttribute("value", gli.Value);
if (!gli.Enabled)
writer.WriteAttribute("disabled", "disabled");
if (gli.Selected)
writer.WriteAttribute("selected", "selected");
writer.Write(HtmlTextWriter.TagRightChar);
writer.Write(gli.Text);
writer.WriteEndTag("option");
}
}
示例13: Render
protected override void Render(HtmlTextWriter writer)
{
List<GroupedListItem> groupedListItems;
writer.WriteBeginTag("select");
writer.WriteAttribute("id", this.ClientID);
writer.WriteAttribute("name", this.UniqueID);
if (ChangeCausesPostback)
writer.WriteAttribute("onchange", "document.forms[0].submit();");
if (ClassName.Length > 0)
writer.WriteAttribute("class", ClassName);
writer.Write(HtmlTextWriter.TagRightChar);
if (DataReady) {
if (_grouplessItems != null && _grouplessItems.Count > 0)
WriteOptions(writer, _grouplessItems);
foreach (string groupName in _optionGroups.Keys) {
writer.WriteBeginTag("optgroup");
writer.WriteAttribute("label", groupName);
writer.Write(HtmlTextWriter.TagRightChar);
if (_optionGroups.TryGetValue(groupName, out groupedListItems)) {
WriteOptions(writer, groupedListItems);
}
writer.WriteEndTag("optgroup");
}
}
writer.WriteEndTag("select");
}
示例14: RenderContents
//[Match("match with ListBox RenderContents")]
/// <summary>
/// Renders the contents.
/// </summary>
/// <param name="w">The w.</param>
protected override void RenderContents(HtmlTextWriter w)
{
var itemHash = Items;
var itemCount = itemHash.Count;
if (itemCount > 0)
{
var isA = false;
for (int itemKey = 0; itemKey < itemCount; itemKey++)
{
var listItem = itemHash[itemKey];
if (listItem.Enabled)
switch (listItem.Attributes["group"])
{
case "begin":
w.WriteBeginTag("optgroup");
w.WriteAttribute("label", listItem.Text);
w.Write('>');
break;
case "end":
w.WriteEndTag("optgroup");
break;
default:
w.WriteBeginTag("option");
if (listItem.Selected)
{
if (isA)
VerifyMultiSelect();
isA = true;
w.WriteAttribute("selected", "selected");
}
w.WriteAttribute("value", listItem.Value, true);
if (listItem.Attributes.Count > 0)
listItem.Attributes.Render(w);
if (Page != null)
Page.ClientScript.RegisterForEventValidation(UniqueID, listItem.Value);
w.Write('>');
HttpUtility.HtmlEncode(listItem.Text, w);
w.WriteEndTag("option");
w.WriteLine();
break;
}
}
}
}
示例15: RenderEndHyperlink
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public virtual void RenderEndHyperlink(HtmlTextWriter writer) {
writer.WriteEndTag("a");
}