本文整理汇总了C#中HtmlTextWriter.RenderBeginTag方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriter.RenderBeginTag方法的具体用法?C# HtmlTextWriter.RenderBeginTag怎么用?C# HtmlTextWriter.RenderBeginTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.RenderBeginTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
protected internal override void Render (HtmlTextWriter writer)
{
writer.RenderBeginTag (HtmlTextWriterTag.Title);
if (HasControls () || HasRenderMethodDelegate ())
RenderChildren (writer);
else
writer.Write (text);
writer.RenderEndTag ();
}
示例2: Render
protected internal override void Render(HtmlTextWriter writer) {
// Render as a label in designer for accessibility
if (RenderAsLabel) {
// Total hack for accessibility of labels for login controls!
writer.Write("<asp:label runat=\"server\" AssociatedControlID=\"");
writer.Write(_for.ID);
writer.Write("\" ID=\"");
writer.Write(_for.ID);
writer.Write("Label\">");
writer.Write(Text);
writer.Write("</asp:label>");
}
else {
writer.AddAttribute(HtmlTextWriterAttribute.For, _for.ClientID);
writer.RenderBeginTag(HtmlTextWriterTag.Label);
base.Render(writer);
writer.RenderEndTag();
}
}
示例3: GetDesignTimeHtml
/// <summary>
/// The design time generated HTML for the control.
/// </summary>
/// <returns>A string containing the HTML rendering.</returns>
public override string GetDesignTimeHtml()
{
// Extremely simple design time rendering!
// will work on something better sooner or later.
// This acts as a placeholder.
Web.PlotSurface2D plot = (Web.PlotSurface2D)Component;
int xs = Convert.ToInt32(plot.Width.Value);
if ( xs < 1 ) return "";
int ys = Convert.ToInt32(plot.Height.Value);
if ( ys < 1 ) return "";
StringWriter sw = new StringWriter();
HtmlTextWriter output= new HtmlTextWriter(sw);
output.AddAttribute("border",plot.BorderWidth.ToString());
output.AddAttribute("borderColor",plot.BorderColor.ToKnownColor().ToString());
output.AddAttribute("cellSpacing","0");
output.AddAttribute("cellPadding","0");
output.AddAttribute("width",xs.ToString());
output.RenderBeginTag("table ");
output.RenderBeginTag("tr");
output.AddAttribute("vAlign","center");
output.AddAttribute("align","middle");
output.AddAttribute("height",ys.ToString());
output.RenderBeginTag("td");
output.RenderBeginTag("P");
output.Write("PlotSurface2D:" + plot.Title);
output.RenderEndTag();
output.RenderEndTag();
output.RenderEndTag();
output.RenderEndTag();
output.Flush();
return sw.ToString();
}
示例4: RenderChildren
protected internal override void RenderChildren (HtmlTextWriter writer)
{
base.RenderChildren (writer);
if (title == null) {
writer.RenderBeginTag (HtmlTextWriterTag.Title);
if (!String.IsNullOrEmpty (titleText))
writer.Write (titleText);
writer.RenderEndTag ();
}
#if NET_4_0
if (descriptionMeta == null && descriptionText != null) {
writer.AddAttribute ("name", "description");
writer.AddAttribute ("content", HttpUtility.HtmlAttributeEncode (descriptionText));
writer.RenderBeginTag (HtmlTextWriterTag.Meta);
writer.RenderEndTag ();
}
if (keywordsMeta == null && keywordsText != null) {
writer.AddAttribute ("name", "keywords");
writer.AddAttribute ("content", HttpUtility.HtmlAttributeEncode (keywordsText));
writer.RenderBeginTag (HtmlTextWriterTag.Meta);
writer.RenderEndTag ();
}
#endif
if (styleSheet != null)
styleSheet.Render (writer);
}
示例5: Render
protected override void Render(HtmlTextWriter writer)
{
//Ugly hack time..
//Placeholder will be the parent control when the user is in wysiwyg mode
//We don't want to close any divs if we're being rendered within the umbraco content editor.
if (!(Parent.TemplateSourceDirectory.EndsWith("umbraco")) && EscapeUserContentBlock)
{
writer.WriteLine("</div>");
}
//Render in Macro div
if (RenderInMacroDiv) {
//Declare this a macro tag
writer.AddAttribute("class", "macro");
writer.RenderBeginTag("div");
}
base.Render(writer);
if (RenderInMacroDiv) {
writer.RenderEndTag();
}
if (!(Parent.TemplateSourceDirectory.EndsWith("umbraco")) && EscapeUserContentBlock)
{
//Re-open the macro
writer.WriteLine("<div class='user-content'>");
}
}
示例6: Render
protected internal override void Render(HtmlTextWriter writer) {
writer.RenderBeginTag(HtmlTextWriterTag.Title);
if (HasControls() || HasRenderDelegate()) {
RenderChildren(writer);
}
else if (_text != null) {
writer.Write(_text);
}
writer.RenderEndTag();
}
示例7: RenderContents
protected override void RenderContents (HtmlTextWriter writer)
{
foreach (ListItem item in Items) {
if (item.Selected) {
writer.AddAttribute (HtmlTextWriterAttribute.Selected, "selected", false);
}
writer.AddAttribute (HtmlTextWriterAttribute.Value, item.Value, true);
writer.RenderBeginTag (HtmlTextWriterTag.Option);
string encoded = HttpUtility.HtmlEncode (item.Text);
writer.Write (encoded);
writer.RenderEndTag ();
writer.WriteLine ();
}
}
示例8: Render
protected override void Render (HtmlTextWriter writer)
{
base.Render (writer);
writer.AddAttribute (HtmlTextWriterAttribute.Name, "ImageMap" + ClientID);
writer.RenderBeginTag (HtmlTextWriterTag.Map);
if (spots != null) {
for (int n=0; n<spots.Count; n++) {
HotSpot spot = spots [n];
writer.AddAttribute (HtmlTextWriterAttribute.Shape, spot.MarkupName);
writer.AddAttribute (HtmlTextWriterAttribute.Coords, spot.GetCoordinates ());
writer.AddAttribute (HtmlTextWriterAttribute.Title, spot.AlternateText);
writer.AddAttribute (HtmlTextWriterAttribute.Alt, spot.AlternateText);
if (spot.AccessKey.Length > 0)
writer.AddAttribute (HtmlTextWriterAttribute.Accesskey, spot.AccessKey);
if (spot.TabIndex != 0)
writer.AddAttribute (HtmlTextWriterAttribute.Tabindex, spot.TabIndex.ToString ());
HotSpotMode mode = spot.HotSpotMode != HotSpotMode.NotSet ? spot.HotSpotMode : HotSpotMode;
switch (mode) {
case HotSpotMode.Inactive:
writer.AddAttribute ("nohref", "true");
break;
case HotSpotMode.Navigate:
string target = spot.Target.Length > 0 ? spot.Target : Target;
writer.AddAttribute (HtmlTextWriterAttribute.Href, spot.NavigateUrl);
writer.AddAttribute (HtmlTextWriterAttribute.Target, target);
break;
case HotSpotMode.PostBack:
writer.AddAttribute (HtmlTextWriterAttribute.Href, Page.ClientScript.GetPostBackClientHyperlink (this, n.ToString()));
break;
}
writer.RenderBeginTag (HtmlTextWriterTag.Area);
writer.RenderEndTag ();
}
}
writer.RenderEndTag ();
}
示例9: RenderLabel
void RenderLabel (HtmlTextWriter w)
{
string text = Text;
if (text.Length > 0) {
if (labelAttributes != null)
labelAttributes.AddAttributes (w);
w.AddAttribute (HtmlTextWriterAttribute.For, ClientID);
w.RenderBeginTag (HtmlTextWriterTag.Label);
w.Write (text);
w.RenderEndTag ();
}
}
示例10: RenderInput
void RenderInput (HtmlTextWriter w, bool enabled)
{
if (ClientID != null && ClientID.Length > 0)
w.AddAttribute (HtmlTextWriterAttribute.Id, ClientID);
w.AddAttribute (HtmlTextWriterAttribute.Type, render_type);
string nameAttr = NameAttribute;
if (nameAttr != null && nameAttr.Length > 0)
w.AddAttribute (HtmlTextWriterAttribute.Name, nameAttr);
InternalAddAttributesToRender (w, enabled);
AddAttributesToRender (w);
if (Checked)
w.AddAttribute (HtmlTextWriterAttribute.Checked, "checked", false);
if (AutoPostBack) {
Page page = Page;
string onclick = page != null ? page.ClientScript.GetPostBackEventReference (GetPostBackOptions (), true) : String.Empty;
onclick = String.Concat ("setTimeout('", onclick.Replace ("\\", "\\\\").Replace ("'", "\\'"), "', 0)");
w.AddAttribute (HtmlTextWriterAttribute.Onclick, BuildScriptAttribute ("onclick", onclick));
}
if (AccessKey.Length > 0)
w.AddAttribute (HtmlTextWriterAttribute.Accesskey, AccessKey);
if (TabIndex != 0)
w.AddAttribute (HtmlTextWriterAttribute.Tabindex,
TabIndex.ToString (NumberFormatInfo.InvariantInfo));
if (common_attrs != null)
common_attrs.AddAttributes (w);
if (inputAttributes != null)
inputAttributes.AddAttributes (w);
w.RenderBeginTag (HtmlTextWriterTag.Input);
w.RenderEndTag ();
}
示例11: RenderVert
void RenderVert (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
{
int itms = user.RepeatedItemCount;
// total number of rows/columns in our table
int cols = RepeatColumns == 0 ? 1 : RepeatColumns;
// this gets ceil (itms / cols)
int rows = (itms + cols - 1) / cols;
bool sep = user.HasSeparators;
bool oti = OuterTableImplied;
int hdr_span = cols * ((sep && cols != 1) ? 2 : 1);
bool table = RepeatLayout == RepeatLayout.Table && !oti;
bool show_empty_trailing_items = true;
bool show_empty_trailing_sep = true;
if (! oti)
RenderBeginTag (w, controlStyle, baseControl);
if (Caption.Length > 0) {
if (CaptionAlign != TableCaptionAlign.NotSet)
w.AddAttribute (HtmlTextWriterAttribute.Align, CaptionAlign.ToString());
w.RenderBeginTag (HtmlTextWriterTag.Caption);
w.Write (Caption);
w.RenderEndTag ();
}
// Render the header
if (user.HasHeader) {
if (oti)
user.RenderItem (ListItemType.Header, -1, this, w);
else if (table) {
w.RenderBeginTag (HtmlTextWriterTag.Tr);
// Make sure the header takes up the full width. We have two
// columns per item if we are using separators, otherwise
// one per item.
if (hdr_span != 1)
w.AddAttribute (HtmlTextWriterAttribute.Colspan, hdr_span.ToString (), false);
if (UseAccessibleHeader)
w.AddAttribute ("scope", "col", false);
Style s = user.GetItemStyle (ListItemType.Header, -1);
if (s != null)
s.AddAttributesToRender (w);
if (UseAccessibleHeader)
w.RenderBeginTag (HtmlTextWriterTag.Th);
else
w.RenderBeginTag (HtmlTextWriterTag.Td);
user.RenderItem (ListItemType.Header, -1, this, w);
w.RenderEndTag (); // td
w.RenderEndTag (); // tr
} else {
user.RenderItem (ListItemType.Header, -1, this, w);
RenderBr (w);
}
}
for (int r = 0; r < rows; r ++) {
if (table)
w.RenderBeginTag (HtmlTextWriterTag.Tr);
for (int c = 0; c < cols; c ++) {
// Find the item number we are in according to the repeat
// direction.
int item = index_vert (rows, cols, r, c, itms);
// This item is blank because there there not enough items
// to make a full row.
if (!show_empty_trailing_items && item >= itms)
continue;
if (table) {
Style s = null;
if (item < itms)
s = user.GetItemStyle (ListItemType.Item, item);
if (s != null)
s.AddAttributesToRender (w);
w.RenderBeginTag (HtmlTextWriterTag.Td);
}
if (item < itms)
user.RenderItem (ListItemType.Item, item, this, w);
if (table)
w.RenderEndTag (); // td
if (sep && cols != 1) {
if (table) {
if (item < itms - 1) {
Style s = user.GetItemStyle (ListItemType.Separator, item);
if (s != null)
s.AddAttributesToRender (w);
}
if (item < itms - 1 || show_empty_trailing_sep)
w.RenderBeginTag (HtmlTextWriterTag.Td);
}
//.........这里部分代码省略.........
示例12: RenderBeginTag
public virtual void RenderBeginTag (HtmlTextWriter writer)
{
AddAttributesToRender (writer);
if (TagKey == HtmlTextWriterTag.Unknown)
writer.RenderBeginTag (TagName);
else
writer.RenderBeginTag (TagKey);
}
示例13: RenderEndTag
public override void RenderEndTag (HtmlTextWriter writer)
{
base.RenderEndTag (writer);
if (!String.IsNullOrEmpty (SkipLinkText)) {
writer.AddAttribute (HtmlTextWriterAttribute.Id, ClientID + "_SkipLink");
writer.RenderBeginTag (HtmlTextWriterTag.A);
writer.RenderEndTag ();
}
}
示例14: BeginNodeTag
void BeginNodeTag (HtmlTextWriter writer, TreeNode node, bool clientExpand)
{
if(node.ToolTip.Length>0)
writer.AddAttribute (HtmlTextWriterAttribute.Title, node.ToolTip);
string navigateUrl = node.NavigateUrl;
if (!String.IsNullOrEmpty (navigateUrl)) {
string target = node.Target.Length > 0 ? node.Target : Target;
#if TARGET_J2EE
string navUrl = ResolveClientUrl (navigateUrl, String.Compare (target, "_blank", StringComparison.InvariantCultureIgnoreCase) != 0);
#else
string navUrl = ResolveClientUrl (navigateUrl);
#endif
writer.AddAttribute (HtmlTextWriterAttribute.Href, navUrl);
if (target.Length > 0)
writer.AddAttribute (HtmlTextWriterAttribute.Target, target);
writer.RenderBeginTag (HtmlTextWriterTag.A);
} else if (node.SelectAction != TreeNodeSelectAction.None) {
if (node.SelectAction == TreeNodeSelectAction.Expand && clientExpand)
writer.AddAttribute (HtmlTextWriterAttribute.Href, GetClientExpandEvent (node));
else
writer.AddAttribute (HtmlTextWriterAttribute.Href, GetClientEvent (node, "sel"));
writer.RenderBeginTag (HtmlTextWriterTag.A);
} else
writer.RenderBeginTag (HtmlTextWriterTag.Span);
}
示例15: RenderContents
override void RenderContents (HtmlTextWriter writer)
{
#if NET_2_0
TableRowSection currentTableSection = TableRowSection.TableHeader;
TableRowSection rowSection;
bool sectionStarted = false;
#endif
if (Rows.Count > 0) {
foreach (TableRow row in Rows) {
#if NET_2_0
if (generateTableSections) {
rowSection = row.TableSection;
if (rowSection < currentTableSection)
throw new HttpException ("The table " + ID + " must contain row sections in order of header, body, then footer.");
if (currentTableSection != rowSection) {
if (sectionStarted) {
writer.RenderEndTag ();
sectionStarted = false;
}
currentTableSection = rowSection;
}
if (!sectionStarted) {
switch (rowSection) {
case TableRowSection.TableHeader:
writer.RenderBeginTag (HtmlTextWriterTag.Thead);
break;
case TableRowSection.TableBody:
writer.RenderBeginTag (HtmlTextWriterTag.Tbody);
break;
case TableRowSection.TableFooter:
writer.RenderBeginTag (HtmlTextWriterTag.Tfoot);
break;
}
sectionStarted = true;
}
}
#endif
if (row != null)
row.RenderControl (writer);
}
#if NET_2_0
if (sectionStarted)
writer.RenderEndTag ();
#endif
}
}