本文整理汇总了C#中HtmlTextWriter.RenderEndTag方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriter.RenderEndTag方法的具体用法?C# HtmlTextWriter.RenderEndTag怎么用?C# HtmlTextWriter.RenderEndTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.RenderEndTag方法的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: 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 (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 ();
}
if (styleSheet != null)
styleSheet.Render (writer);
}
示例4: 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();
}
示例5: 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);
}
//.........这里部分代码省略.........
示例6: ShowUpdateForm
/// <summary>
/// Generates a SPARQL Update Form
/// </summary>
/// <param name="context">HTTP Context</param>
protected virtual void ShowUpdateForm(HttpContext context)
{
//Set Content Type
context.Response.Clear();
context.Response.ContentType = "text/html";
//Get a HTML Text Writer
HtmlTextWriter output = new HtmlTextWriter(new StreamWriter(context.Response.OutputStream));
//Page Header
output.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
output.RenderBeginTag(HtmlTextWriterTag.Html);
output.RenderBeginTag(HtmlTextWriterTag.Head);
output.RenderBeginTag(HtmlTextWriterTag.Title);
output.WriteEncodedText("SPARQL Update Interface");
output.RenderEndTag();
//Add Stylesheet
if (!this._config.Stylesheet.Equals(String.Empty))
{
output.AddAttribute(HtmlTextWriterAttribute.Href, this._config.Stylesheet);
output.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
output.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet");
output.RenderBeginTag(HtmlTextWriterTag.Link);
output.RenderEndTag();
}
output.RenderEndTag();
//Header Text
output.RenderBeginTag(HtmlTextWriterTag.Body);
output.RenderBeginTag(HtmlTextWriterTag.H3);
output.WriteEncodedText("SPARQL Update Interface");
output.RenderEndTag();
//Query Form
output.AddAttribute(HtmlTextWriterAttribute.Name, "sparqlUpdate");
output.AddAttribute("method", "get");
output.AddAttribute("action", context.Request.Path);
output.RenderBeginTag(HtmlTextWriterTag.Form);
if (!this._config.IntroductionText.Equals(String.Empty))
{
output.RenderBeginTag(HtmlTextWriterTag.P);
output.Write(this._config.IntroductionText);
output.RenderEndTag();
}
output.WriteEncodedText("Update");
output.WriteBreak();
output.AddAttribute(HtmlTextWriterAttribute.Name, "update");
output.AddAttribute(HtmlTextWriterAttribute.Rows, "15");
output.AddAttribute(HtmlTextWriterAttribute.Cols, "100");
output.RenderBeginTag(HtmlTextWriterTag.Textarea);
output.WriteEncodedText(this._config.DefaultUpdate);
output.RenderEndTag();
output.WriteBreak();
//output.WriteEncodedText("Default Graph URI: ");
//output.AddAttribute(HtmlTextWriterAttribute.Name, "default-graph-uri");
//output.AddAttribute(HtmlTextWriterAttribute.Type, "text");
//output.AddAttribute(HtmlTextWriterAttribute.Size, "100");
//output.AddAttribute(HtmlTextWriterAttribute.Value, this._config.DefaultGraphURI);
//output.RenderBeginTag(HtmlTextWriterTag.Input);
//output.RenderEndTag();
//output.WriteBreak();
output.AddAttribute(HtmlTextWriterAttribute.Type, "submit");
output.AddAttribute(HtmlTextWriterAttribute.Value, "Perform Update");
output.RenderBeginTag(HtmlTextWriterTag.Input);
output.RenderEndTag();
output.RenderEndTag(); //End Form
//End of Page
output.RenderEndTag(); //End Body
output.RenderEndTag(); //End Html
output.Flush();
}
示例7: 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();
}
示例8: 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
}
}
示例9: 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 ();
}
}
示例10: 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 ();
}
}
示例11: 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 ();
}
}
示例12: RenderBeginTag
public override void RenderBeginTag (HtmlTextWriter writer)
{
string skipLinkText = SkipLinkText;
if (!String.IsNullOrEmpty (skipLinkText)) {
writer.AddAttribute (HtmlTextWriterAttribute.Href, "#" + ClientID + "_SkipLink");
writer.RenderBeginTag (HtmlTextWriterTag.A);
ClientScriptManager csm = new ClientScriptManager (null);
writer.AddAttribute (HtmlTextWriterAttribute.Alt, skipLinkText);
writer.AddAttribute (HtmlTextWriterAttribute.Src, csm.GetWebResourceUrl (typeof (SiteMapPath), "transparent.gif"));
writer.AddAttribute (HtmlTextWriterAttribute.Height, "0");
writer.AddAttribute (HtmlTextWriterAttribute.Width, "0");
writer.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px");
writer.RenderBeginTag (HtmlTextWriterTag.Img);
writer.RenderEndTag (); // img
writer.RenderEndTag (); // a
}
base.RenderBeginTag (writer);
}
示例13: RenderContents
protected internal override void RenderContents (HtmlTextWriter w)
{
if (HasControls () || HasRenderMethodDelegate ()) {
base.RenderContents (w);
return;
}
string image_url = ImageUrl;
if (!String.IsNullOrEmpty (image_url)) {
string str = ToolTip;
if (!String.IsNullOrEmpty (str))
w.AddAttribute (HtmlTextWriterAttribute.Title, str);
w.AddAttribute (HtmlTextWriterAttribute.Src, ResolveClientUrl (image_url));
str = Text;
#if !NET_4_0
if (!String.IsNullOrEmpty (str))
#endif
w.AddAttribute (HtmlTextWriterAttribute.Alt, str);
#if !NET_4_0
w.AddStyleAttribute (HtmlTextWriterStyle.BorderWidth, "0px");
#endif
w.RenderBeginTag (HtmlTextWriterTag.Img);
w.RenderEndTag ();
} else
w.Write (Text);
}
示例14: WriteDayHeader
//
// Private methods
//
void WriteDayHeader (HtmlTextWriter writer)
{
int i, first;
string dayName;
i = first = (int) (DisplayFirstDayOfWeek);
TableCell cell;
writer.RenderBeginTag (HtmlTextWriterTag.Tr);
if (SelectionMode == CalendarSelectionMode.DayWeek) {
cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Center;
cell.ApplyStyle (DayHeaderStyle);
// Empty Cell
cell.RenderBeginTag (writer);
cell.RenderEndTag (writer);
} else {
if (SelectionMode == CalendarSelectionMode.DayWeekMonth) {
TableCell selector = new TableCell ();
selector.ApplyStyle (SelectorStyle);
selector.HorizontalAlign = HorizontalAlign.Center;
DateTime date = new DateTime (DisplayDate.Year, DisplayDate.Month, 1); // first date
int days = DateTime.DaysInMonth (DisplayDate.Year, DisplayDate.Month);
selector.RenderBeginTag (writer);
writer.Write (BuildLink ("R" + GetDaysFromZenith (date) + days, SelectMonthText, DayHeaderStyle.ForeColor, Enabled));
selector.RenderEndTag (writer);
}
}
DateTimeFormatInfo dti = DateInfo;
while (true) {
DayOfWeek dayOfWeek = (DayOfWeek) i;
dayName = dti.GetDayName (dayOfWeek);
#if NET_2_0
if (UseAccessibleHeader) {
writer.AddAttribute (HtmlTextWriterAttribute.Abbr, dayName);
writer.AddAttribute (HtmlTextWriterAttribute.Scope, "col", false);
cell = new TableHeaderCell();
}
else
#endif
cell = new TableCell();
cell.HorizontalAlign = HorizontalAlign.Center;
cell.ApplyStyle (DayHeaderStyle);
cell.RenderBeginTag (writer);
switch (DayNameFormat) {
case DayNameFormat.FirstLetter:
dayName = dayName.Substring (0, 1);
break;
case DayNameFormat.FirstTwoLetters:
dayName = dayName.Substring (0, 2);
break;
#if NET_2_0
case DayNameFormat.Shortest:
dayName = dti.GetShortestDayName (dayOfWeek);
break;
#endif
case DayNameFormat.Full:
break;
case DayNameFormat.Short:
default:
dayName = dti.GetAbbreviatedDayName (dayOfWeek);
break;
}
writer.Write (dayName);
cell.RenderEndTag (writer);
if (i >= daysInAWeek - 1) {
i = 0;
}
else {
i++;
}
if (i == first)
break;
}
writer.RenderEndTag ();
}
示例15: Render
override void Render (HtmlTextWriter writer)
{
TableStyle ts = new TableStyle ();
ts.CellSpacing = CellSpacing;
ts.CellPadding = CellPadding;
ts.BorderWidth = 1;
if (ControlStyleCreated)
ts.CopyFrom (ControlStyle);
if (ShowGridLines)
ts.GridLines = GridLines.Both;
ts.AddAttributesToRender (writer);
writer.AddAttribute (HtmlTextWriterAttribute.Id, ClientID);
writer.RenderBeginTag (HtmlTextWriterTag.Table);
#if NET_2_0
if (Caption != "")
WriteCaption (writer);
#endif
if (ShowTitle)
WriteTitle (writer);
if (ShowDayHeader)
WriteDayHeader (writer);
WriteDays (writer);
writer.RenderEndTag ();
}