本文整理汇总了C#中Literal类的典型用法代码示例。如果您正苦于以下问题:C# Literal类的具体用法?C# Literal怎么用?C# Literal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Literal类属于命名空间,在下文中一共展示了Literal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: loadAdvise
public void loadAdvise()
{
usersTableAdapters.GetUserNameTableAdapter user = new usersTableAdapters.GetUserNameTableAdapter();
InvestmentDSTableAdapters.GetAdviseTableAdapter advise = new InvestmentDSTableAdapters.GetAdviseTableAdapter();
InvestmentDS.GetAdviseDataTable tblAdvise =advise.GetAdvise(MySessionManager.InvAppID, MySessionManager.ClientID);
if (tblAdvise.Rows.Count > 0)
{
foreach (InvestmentDS.GetAdviseRow r in tblAdvise)
{
//txtDescription.Value = tblAdvise[0].datDescription.ToString();
HtmlGenericControl myp = new HtmlGenericControl("p");
HtmlGenericControl mypMessage = new HtmlGenericControl("blockquote");
HtmlGenericControl myDiv = new HtmlGenericControl("div");
myDiv.Attributes["class"] = " col-md-12 alert alert-info";
myDiv.Style["padding"] = "4px";
myp.InnerHtml = "<h5><span> Stage:" + r.datStage.ToString() + "</span><br/><i> <b> " + user.Getuser(r.userID).ToString() +"</b>'s comment on " + r.modifiedDate.ToLongDateString() + "</i></h5>"
+ "<hr style='margin:3px'/>";
mypMessage.Attributes["class"] = "text-justify";
mypMessage.InnerHtml = "<p>" + r.datDescription.ToString() + "</p>";
Literal myLine = new Literal();
myLine.Text = "<hr style='margin:3px'/><br/>";
myDiv.Controls.Add(myp);
myDiv.Controls.Add(myLine);
myDiv.Controls.Add(mypMessage);
myDiv.Controls.Add(myLine);
this.Comments.Controls.Add(myDiv);
}
}
}
示例2: cmdSubmit_Click
protected void cmdSubmit_Click(object sender, EventArgs e)
{
//if (txtFname.Text != "Jason")
//{
// Response.Write("Oh no!");
//}
System.Web.UI.WebControls.Label lblFName = new Label();
lblFName.ID = "lblFName";
lblFName.Text = txtFname.Text;
System.Web.UI.WebControls.Label lblEmail = new Label();
lblEmail.ID = "lblEmail";
lblEmail.Text = txtEmail.Text;
System.Web.UI.WebControls.Literal lit1 = new Literal();
lit1.Text = "<br />";
System.Web.UI.WebControls.Literal lit2 = new Literal();
lit2.Text = "<br />";
PlaceHolder1.Controls.Add(lit1);
PlaceHolder1.Controls.Add(lblEmail);
PlaceHolder1.Controls.Add(lit2);
PlaceHolder1.Controls.Add(lblFName);
lblhidden.Text = Request.Form["ctl00$MainContent$txtFname"];
lblhidden.Visible = true;
}
示例3: ShowErrorMsg
private void ShowErrorMsg(string msg)
{
//Display error message
Literal script = new Literal();
script.Text = "<script language='javascript'>alert(\"" + msg + "\");</script>";
this.Controls.Add(script);
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try
{
//如果不設定這個,畫面在第一次讀取關閉後,就不會再跑Page_Load了.
Response.Expires = 0;
//動態加入_self,不然會另開新視窗
Literal litCss = new Literal();
litCss.Text = @"<base target=""_self"">";
this.Header.Controls.Add(litCss);
ErrorMsgLabel.Text = "";
if (!IsPostBack)
{
Init_Data();
}
}
catch (Exception ex)
{
ErrorMsgLabel.Text = ex.Message;
}
finally
{
}
}
示例5: fillWipTables
private void fillWipTables()
{
string IP = Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? Request.ServerVariables["REMOTE_ADDR"];
DataTable DT = theCake.getWipTasks(theCake.getActiveUserName(IP));
string TableString = "";
if (DT.Rows.Count > 0)
{
foreach (DataRow DR in DT.Rows)
{
Literal sectionControl = new Literal();
float percentComplete = float.Parse(DR["Percent_Completed"].ToString()) / 100;
TableString += "<section><a href=\"ViewTask.aspx?ID=" + DR["ID"].ToString() + "\"><h3>" + DR["taskName"].ToString() + "</h3><p>Progress: <progress value=\"" + percentComplete + "\" /></p></a></section>";
sectionControl.Text = TableString;
pnl_WipTasks.Controls.Add(sectionControl);
}
}
else
{
Literal sectionControl = new Literal();
TableString += "No projects available";
sectionControl.Text = TableString;
pnl_WipTasks.Controls.Add(sectionControl);
}
}
示例6: GetValue
protected override string GetValue(Literal literal)
{
if (literal == null)
throw new ArgumentNullException(nameof(literal));
return literal.Identifier;
}
示例7: DataBindTemplate
public void DataBindTemplate(object sender, EventArgs e)
{
PlaceHolder templatePlaceHolder = sender as PlaceHolder;
ComboBoxItemTemlateContainer container = templatePlaceHolder.NamingContainer as ComboBoxItemTemlateContainer;
ComboBoxItem item = (ComboBoxItem)container.Parent;
Literal companyNameText = new Literal();
if(!isPostBack)
companyNameText.Text = "<span class=\"template-name\">" + DataBinder.Eval(item.DataItem, "CompanyName").ToString() + "</span>";
Literal countryText1 = new Literal();
if (!isPostBack)
countryText1.Text = " / <span class=\"template-country\">" + DataBinder.Eval(item.DataItem, "Country").ToString() + " ";
Image flag = new Image();
if (!isPostBack)
flag.ImageUrl = GetCountryFlag(DataBinder.Eval(item.DataItem, "Country").ToString());
Literal countryText2 = new Literal();
if (!isPostBack)
countryText2.Text = "</span>";
templatePlaceHolder.Controls.Add(companyNameText);
templatePlaceHolder.Controls.Add(countryText1);
templatePlaceHolder.Controls.Add(flag);
templatePlaceHolder.Controls.Add(countryText2);
}
示例8: literal_html_encodes_its_value
public void literal_html_encodes_its_value()
{
const string value = "<div>Foo</div>";
var html = new Literal("test").Value(value).ToString();
html.ShouldRenderHtmlDocument().ChildNodes[0]
.ShouldHaveInnerTextEqual(HttpUtility.HtmlEncode(value));
}
示例9: CheckProcessResponsesStatus
/// <summary>
/// Checks whether the process responses is already running, and changes the status message.
/// </summary>
/// <param name="btnProcessIncomingResponse"></param>
/// <param name="litIncomingInfo"></param>
/// <author>Saad Mansour</author>
public static void CheckProcessResponsesStatus(RadButton btnProcessIncomingResponse, Literal litIncomingInfo)
{
try
{
if (GlobalVariables.IsProcessIncomingRunning)
{
if (btnProcessIncomingResponse != null)
{
btnProcessIncomingResponse.Enabled = false;
litIncomingInfo.Text = "Processing is already Running. Please, wait.";
}
}
else
{
if (btnProcessIncomingResponse != null)
{
string[] files = Directory.GetFiles(Utility.GetResponseFilesFolderName() + "incoming");
if (files.Length > 0)
{
btnProcessIncomingResponse.Enabled = true;
litIncomingInfo.Text = "New Form Response(s): " + files.Length;
}
else
{
btnProcessIncomingResponse.Enabled = false;
litIncomingInfo.Text = "All Responses have been processed.";
}
}
}
}
catch (Exception ex)
{
LogUtils.WriteErrorLog(ex.ToString());
}
}
示例10: Escape
static string Escape(this char ch, Literal literal)
{
switch (ch)
{
case '\"': return literal == Literal.String ? "\\\"" : Char.ToString(ch);
case '\'': return literal == Literal.Character ? "\\\'" : Char.ToString(ch);
case '\\': return "\\\\";
case '\0': return "\\0";
case '\a': return "\\a";
case '\b': return "\\b";
case '\f': return "\\f";
case '\n': return "\\n";
case '\r': return "\\r";
case '\t': return "\\t";
case '\v': return "\\v";
case '\u0085': //Next Line
case '\u2028': //Line Separator
case '\u2029': //Paragraph Separator
return string.Format("\\u{0:X4}", (int)ch);
default:
return Char.ToString(ch);
}
}
示例11: GetSmartPartInfo
public override Sage.Platform.Application.UI.ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType)
{
Sage.Platform.WebPortal.SmartParts.ToolsSmartPartInfo tinfo = new Sage.Platform.WebPortal.SmartParts.ToolsSmartPartInfo();
tinfo.Description = "Web Info";
tinfo.Title = "Web Info";
Literal spacer = new Literal();
spacer.Text = " ";
Label label1 = new Label();
label1.Text = "WebSites ";
tinfo.CenterTools.Add(label1);
tinfo.CenterTools.Add(ddlUrls);
tinfo.RightTools.Add(cmdAdd);
tinfo.RightTools.Add(spacer);
tinfo.RightTools.Add(cmdEdit);
tinfo.RightTools.Add(spacer);
tinfo.RightTools.Add(cmdDelete);
tinfo.RightTools.Add(spacer);
tinfo.RightTools.Add(cmdRefresh);
return tinfo;
}
示例12: MensajeJQuery
public void MensajeJQuery(String Message)
{
//*******************************************
// MensajeJQuery
//*******************************************
//En esta ocasión agregaremos un literal que a su vez agregaremos un div que nos servira de Dialog
//O si prefieren pueden crear el div directamente en el HTML
Literal li = new Literal();
StringBuilder sbMensaje = new StringBuilder();
//Creamos el Div
sbMensaje.Append("<div id='dialog-message' title='Aviso'>");
sbMensaje.Append("<div class='ui-widget'>");
sbMensaje.Append("<div class='ui-state-error ui-corner-all'style='padding: 0 .7em;'>");
sbMensaje.Append("<p><span class='ui-icon ui-icon-alert' style='float: left; margin-right: .3em;'></span>");
//Le indicamos el mensaje a mostrar
sbMensaje.Append(Message);
//cerramos el div
sbMensaje.Append("</p></div></div></div>");
sbMensaje.Append("<script type='text/javascript'>");
sbMensaje.Append("$(function() {");
//Destruimos cualquier rastro de dialogo abierto
sbMensaje.Append("$('#dialog-message').dialog('destroy');");
//Si quieres que muestre un boton para cerrar el mensaje seria esta linea que dejare en comentario
sbMensaje.Append("$('#dialog-message').dialog({ modal: true, buttons: { 'Ok': function() { $( this ).dialog('close'); } } });");
sbMensaje.Append("});");
sbMensaje.Append("</script>");
//Agremamos el texto del stringbuilder al literal
li.Text = sbMensaje.ToString();
//Agregamos el literal a la pagina
Page.Controls.Add(li);
}
示例13: BindFBComment
public void BindFBComment(string Vid)
{
string str = "<div id=\"fb-root\"></div><script src=\"http://connect.facebook.net/en_US/all.js#appId=" + Settings.FBAppId + "&xfbml=1\"></script><fb:comments xid=\"" + Vid + "\" href=\"http://www.timeflies.by/" + Vid + "&" + "\" num_posts=\"4\" width=\"500\"></fb:comments>";
Literal myScript = new Literal();
myScript.Text = str;
FBCommentPlaceHolder.Controls.Add(myScript);
}
示例14: GridTeachers_RowDataBound
protected void GridTeachers_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HtmlAnchor aPages = e.Row.Cells[0].FindControl("aPages") as HtmlAnchor;
PlaceHolder ltTchs = e.Row.Cells[1].FindControl("ltTchs") as PlaceHolder;
HtmlAnchor aMore = e.Row.Cells[0].FindControl("aMore") as HtmlAnchor;
Field fd = e.Row.DataItem as Field;
if (fd != null)
{
aPages.HRef = aMore.HRef = Utils.AbsoluteWebRoot + @"TeacherList.aspx?fid=" + fd.Id;
int num = 0;
foreach (MembershipUser user in Membership.GetAllUsers())
{
AuthorProfile ap = AuthorProfile.GetProfile(user.UserName);
if (ap!=null && ap.IsTeacher && !ap.IsAdmin && ap.IsPrivate && ap.Fields.Contains(fd.Id.ToString()) && num<9)
{
HtmlAnchor aTch = new HtmlAnchor();
aTch.HRef = Utils.AbsoluteWebRoot + @"Views\TeacherView.aspx?uid=" + ap.UserName;
aTch.Title = ap.DisplayName;
aTch.InnerText = StripString(ap.DisplayName, 4);
//aTch.Style.Add(HtmlTextWriterStyle.Color, "#333333");
ltTchs.Controls.Add(aTch);
Literal lt = new Literal();
lt.Text = " ";
ltTchs.Controls.Add(lt);
num++;
}
}
}
}
}
示例15: OnPreRender
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
MonkData db = new MonkData();
foreach(PropertyInfo tablePInfo in db.GetType().GetProperties())
{
Type[] genericTypes = tablePInfo.PropertyType.GetGenericArguments();
if(genericTypes.Count() < 1)
continue;
if(!CanUserAccessTable(genericTypes[0].Name, false, ref db))
{
continue;
}
HyperLink hlTypeEdit = new HyperLink();
hlTypeEdit.NavigateUrl = "AddEdit.aspx?typename=" + genericTypes[0].Name;
hlTypeEdit.Text = "Add " + GetFieldNameFromString( tablePInfo.Name);
plcAddItemsList.Controls.Add(hlTypeEdit);
Literal litLineBreak = new Literal();
litLineBreak.Text = "<br />";
plcAddItemsList.Controls.Add(litLineBreak);
HyperLink hlTypeGridView = new HyperLink();
hlTypeGridView.NavigateUrl = "GridView.aspx?typename=" + genericTypes[0].Name;
hlTypeGridView.Text = GetFieldNameFromString( tablePInfo.Name);
plcViewItems.Controls.Add(hlTypeGridView);
Literal litLineBreakGridView = new Literal();
litLineBreakGridView.Text = "<br />";
plcViewItems.Controls.Add(litLineBreakGridView);
}
}