本文整理汇总了C#中HtmlTextWriter.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriter.WriteLine方法的具体用法?C# HtmlTextWriter.WriteLine怎么用?C# HtmlTextWriter.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.WriteLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderControl
public override void RenderControl(HtmlTextWriter writer)
{
string postId = Attributes["PostID"],
postTitle = Attributes["PostTitle"];
string postUrl = string.Empty;
BXSearchQuery q = new BXSearchQuery();
q.FieldsToSelect.Add(BXSearchField.Id);
q.FieldsToSelect.Add(BXSearchField.ModuleId);
q.FieldsToSelect.Add(BXSearchField.ItemId);
q.FieldsToSelect.Add(BXSearchField.Body);
q.FieldsToSelect.Add(BXSearchField.Title);
q.FieldsToSelect.Add(BXSearchField.Param1);
q.FieldsToSelect.Add(BXSearchField.Param2);
BXSearchContentGroupFilter f = new BXSearchContentGroupFilter(BXFilterExpressionCombiningLogic.And);
f.Add(new BXFormFilterItem("moduleId", "blog", BXSqlFilterOperators.Equal));
f.Add(new BXFormFilterItem("itemId", "p" + postId, BXSqlFilterOperators.Equal));
q.Filter = f;
BXSearchResultCollection c = q.Execute();
if (c.Count > 0)
postUrl = c.Count > 0 && c[0].Urls.Length > 0 ? c[0].Urls[0] : string.Empty;
if(postUrl.Length > 0)
writer.WriteLine(@"<a target=""_blank"" href=""" + HttpUtility.HtmlAttributeEncode(postUrl) + @""">" + HttpUtility.HtmlEncode(postTitle) + @"</a>");
else
writer.WriteLine(HttpUtility.HtmlEncode(postTitle));
}
示例2: ExportGridToExcel
private void ExportGridToExcel()
{
Response.Clear();
Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
Response.Charset = "";
string FileName = "Phieu_de_nghi_Cap_" + CIPConvert.ToStr(m_hdf_ma_trung_tam.Value) + "_" + DateTime.Now.ToString("yyyyMMdd") +".xls";
StringWriter strwritter = new StringWriter();
HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
htmltextwrtter.Write(" ");
m_lbl_header.RenderControl(htmltextwrtter);
htmltextwrtter.WriteLine("<br />");
// tên phòng ban
htmltextwrtter.Write(" ");
m_lbl_title.RenderControl(htmltextwrtter);
htmltextwrtter.WriteLine("<br />");
//m_lbl_title_ma_don_hang.RenderControl(htmltextwrtter);
//Mã đơn hàng
m_lbl_MP.RenderControl(htmltextwrtter);
m_lbl_ma_don_hang_de.RenderControl(htmltextwrtter);
htmltextwrtter.Write(" ");
m_lbl_pop_lan_tl.RenderControl(htmltextwrtter);
htmltextwrtter.Write("   ");
m_lbl_pop_lan.RenderControl(htmltextwrtter);
htmltextwrtter.Write(" ");
m_lbl_pop_ngay_dat_hang_tl.RenderControl(htmltextwrtter);
htmltextwrtter.Write("   ");
m_lbl_pop_ngay.RenderControl(htmltextwrtter);
htmltextwrtter.Write(" ");
m_lbl_pop_tong_tien_tl.RenderControl(htmltextwrtter);
htmltextwrtter.Write("   ");
m_lbl_pop_tong_tien.RenderControl(htmltextwrtter);
htmltextwrtter.Write(" ");
m_lbl_pop_dinh_muc_tl.RenderControl(htmltextwrtter);
htmltextwrtter.Write("   ");
m_lbl_pop_dinh_muc.RenderControl(htmltextwrtter);
m_grv_don_hang_de.GridLines = GridLines.Both;
m_grv_don_hang_de.HeaderStyle.Font.Bold = true;
m_grv_don_hang_de.RenderControl(htmltextwrtter);
Response.Write(strwritter.ToString());
Response.End();
}
示例3: RenderOptionGroupBeginTag
private void RenderOptionGroupBeginTag(string name, HtmlTextWriter writer)
{
writer.WriteBeginTag("optgroup");
writer.WriteAttribute("label", name);
writer.Write(HtmlTextWriter.TagRightChar);
writer.WriteLine();
}
示例4: 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'>");
}
}
示例5: Export
public static void Export(string fileName, GridView gv, string title)
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader(
"content-disposition", string.Format("attachment; filename={0}", fileName));
HttpContext.Current.Response.ContentType = "application/ms-excel";
HttpContext.Current.Response.Charset = "utf-8";
HttpContext.Current.Response.Write("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body>");
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
htw.WriteLine("<h1>" + title + "</h1>");
// Create a form to contain the grid
Table table = new Table();
table.GridLines = gv.GridLines;
// add the header row to the table
if (gv.HeaderRow != null)
{
GridViewExportUtil.PrepareControlForExport(gv.HeaderRow);
table.Rows.Add(gv.HeaderRow);
}
// add each of the data rows to the table
foreach (GridViewRow row in gv.Rows)
{
GridViewExportUtil.PrepareControlForExport(row);
table.Rows.Add(row);
}
// add the footer row to the table
if (gv.FooterRow != null)
{
GridViewExportUtil.PrepareControlForExport(gv.FooterRow);
table.Rows.Add(gv.FooterRow);
}
// render the table into the htmlwriter
table.RenderControl(htw);
// render the htmlwriter into the response
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.Write("</body></html>");
HttpContext.Current.Response.End();
}
}
}
示例6: 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();
}
示例7: ExportDialog
public static void ExportDialog(string One, string two, string three, DataSet ds, Page page)
{
string title = DateTime.Now.ToString("yyMMdd") + three + ".xls";
System.Web.UI.WebControls.DataGrid DataGrid1 = new DataGrid();
HttpResponse response = HttpContext.Current.Response;
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
StringWriter tw = new StringWriter();
HtmlTextWriter myWrite = new HtmlTextWriter(tw);
if (One != "")
myWrite.WriteLine(One);
if (two != "")
myWrite.WriteLine(two);
DataGrid1.RenderControl(myWrite);
response.Clear();
response.Buffer = true;
response.Charset = "GB2312";
response.Write("<meta http-equiv=Content-Type content=text/html;charset=GB2312>");
response.AppendHeader("Content-Disposition", "attachment;filename=" + title);
response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
response.ContentType = "application/vnd.xls";//Response.ContentType= "application/msword";
page.EnableViewState = false;
response.Write(tw.ToString());
response.End();
}
示例8: GenerateOutput
/// <summary>
/// Internal method which generates the HTML Output for the Sparql Results
/// </summary>
/// <param name="results"></param>
/// <param name="output"></param>
private void GenerateOutput(SparqlResultSet results, TextWriter output)
{
HtmlTextWriter writer = new HtmlTextWriter(output);
QNameOutputMapper qnameMapper = new QNameOutputMapper(this._namespaces != null ? this._namespaces : new NamespaceMapper(true));
//Page Header
writer.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
writer.RenderBeginTag(HtmlTextWriterTag.Html);
writer.RenderBeginTag(HtmlTextWriterTag.Head);
writer.RenderBeginTag(HtmlTextWriterTag.Title);
writer.WriteEncodedText("SPARQL Query Results");
writer.RenderEndTag();
if (!this.Stylesheet.Equals(String.Empty))
{
writer.AddAttribute(HtmlTextWriterAttribute.Href, this.Stylesheet);
writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/css");
writer.AddAttribute(HtmlTextWriterAttribute.Rel, "stylesheet");
writer.RenderBeginTag(HtmlTextWriterTag.Link);
writer.RenderEndTag();
}
//TODO: Add <meta> for charset?
writer.RenderEndTag();
//Start Body
writer.RenderBeginTag(HtmlTextWriterTag.Body);
if (results.ResultsType == SparqlResultsType.VariableBindings)
{
//Create a Table for the results
writer.AddAttribute(HtmlTextWriterAttribute.Width, "100%");
writer.RenderBeginTag(HtmlTextWriterTag.Table);
//Create a Table Header with the Variable Names
writer.RenderBeginTag(HtmlTextWriterTag.Thead);
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
foreach (String var in results.Variables)
{
writer.RenderBeginTag(HtmlTextWriterTag.Th);
writer.WriteEncodedText(var);
writer.RenderEndTag();
}
writer.RenderEndTag();
writer.RenderEndTag();
#if !NO_WEB
writer.WriteLine();
#endif
//Create a Table Body for the Results
writer.RenderBeginTag(HtmlTextWriterTag.Tbody);
//Create a Column for each Binding
foreach (SparqlResult result in results)
{
//Start Row
writer.RenderBeginTag(HtmlTextWriterTag.Tr);
foreach (String var in results.Variables)
{
//Start Column
writer.RenderBeginTag(HtmlTextWriterTag.Td);
if (result.HasValue(var))
{
INode value = result[var];
if (value != null)
{
switch (value.NodeType)
{
case NodeType.Blank:
writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClassBlankNode);
writer.RenderBeginTag(HtmlTextWriterTag.Span);
writer.WriteEncodedText(value.ToString());
writer.RenderEndTag();
break;
case NodeType.Literal:
ILiteralNode lit = (ILiteralNode)value;
writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClassLiteral);
writer.RenderBeginTag(HtmlTextWriterTag.Span);
if (lit.DataType != null)
{
writer.WriteEncodedText(lit.Value);
writer.RenderEndTag();
writer.WriteEncodedText("^^");
writer.AddAttribute(HtmlTextWriterAttribute.Href, this._formatter.FormatUri(lit.DataType.ToString()));
writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClassDatatype);
writer.RenderBeginTag(HtmlTextWriterTag.A);
writer.WriteEncodedText(lit.DataType.ToString());
writer.RenderEndTag();
}
else
{
//.........这里部分代码省略.........
示例9: RenderContents
protected override void RenderContents(HtmlTextWriter writer)
{
#region Generate HTML for Hand Panel container opening DIV
writer.Indent += 1;
writer.WriteLine("");
writer.WriteLine("");
writer.WriteLine(String.Format("<!-- ### Hand {0} ###-->", _hand_index));
writer.WriteLine(String.Format("<div id='hedgeem_control_hand_panel_hand_{0}' class='hedgeem_control_hand_panel' {1}>", _hand_index, f_generate_onclick_code()));
writer.Indent += 1;
#endregion
f_render_cards(writer);
#region Draw the components of the hand panel for when the hand is 'Dead'
if (_is_dead)
{
writer.WriteLine("<!-- Dead Hand Indicator icon -->");
writer.WriteLine("<div id='h" + _hand_index + "idead' class='icon_dead'>");
writer.Indent += 1;
writer.WriteLine("");
writer.Indent -= 1;
writer.WriteLine("</div>");
writer.WriteLine("");
}
#endregion
f_render_status_icons(writer);
f_render_previous_placed_bets(writer);
#region Generate the HTML that indicates the hand is a winner (if it is).
if (_is_winner)
{
writer.WriteLine("<!-- Winner icon -->");
writer.WriteLine("<div id='h" + _hand_index + "iwin' class='icon_winner'>");
// Commented out but Simon 9th Aug 2014 as image presented via css
//writer.Indent += 1;
//writer.AddAttribute(HtmlTextWriterAttribute.Src, "../resources/icons/icon_winning_hand_indicator1.png");
//writer.RenderBeginTag(HtmlTextWriterTag.Img);
//writer.RenderEndTag();
///writer.WriteLine("");
//writer.Indent -= 1;
writer.WriteLine("</div>");
writer.WriteLine("");
}
#endregion _is_winner
#region Generate the HTML that shows the 'Hand Description' Block
if (_show_description)
{
#region Generate the HTML to display the hand description container opening DIVS
writer.WriteLine("");
writer.WriteLine("<!-- Hand " + _hand_index + ", Hand Panel -->");
writer.WriteLine("<div id='h" + _hand_index + "_payout' onclick='javascript:f_placebet(" + _hand_index + ");' class='hedgeem_control_hand_panel_info_background'>");
writer.Indent += 1;
#endregion
f_render_hand_description(writer);
//f_render_payoutvalue(writer);
#region Generate the HTML to display the hand description container closing DIVS
writer.WriteLine("");
writer.WriteLine("</div>");
base.RenderContents(writer);
writer.Indent -= 1;
#endregion
}
#endregion if_show_description
#region Generate HTML for Hand Panel container closing DIV
writer.WriteLine("</div>");
writer.Indent -= 1;
#endregion
}
示例10: f_render_payoutvalue
/// <summary>
///
/// </summary>
/// <param name="writer"></param>
private void f_render_payoutvalue(HtmlTextWriter writer)
{
if (!_is_dead)
{
writer.WriteLine("");
writer.Write(String.Format("<div id='payout_value_h{0}' class='payoutvalue'> {1}</div>",
_hand_index,
p_payout_string));
writer.Indent -= 1;
}
}
示例11: 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();
}
示例12: RenderChildren
override void RenderChildren (HtmlTextWriter writer)
{
if (HasControls ()) {
writer.Indent++;
base.RenderChildren (writer);
writer.Indent--;
writer.WriteLine ();
}
}
示例13: RenderList
void RenderList (HtmlTextWriter w, IRepeatInfoUser user, Style controlStyle, WebControl baseControl)
{
int items = user.RepeatedItemCount;
RenderBeginTag (w, controlStyle, baseControl);
for (int i = 0; i < items; i++) {
// Style s = null;
// s = user.GetItemStyle (ListItemType.Item, i);
// if (s != null)
// s.AddAttributesToRender (w);
w.RenderBeginTag (HtmlTextWriterTag.Li);
user.RenderItem (ListItemType.Item, i, this, w);
w.RenderEndTag (); // </li>
w.WriteLine ();
}
w.RenderEndTag ();
}
示例14: 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 ();
}
}
示例15: 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 ();
}
}