本文整理汇总了C#中System.Web.UI.WebControls.Literal类的典型用法代码示例。如果您正苦于以下问题:C# Literal类的具体用法?C# Literal怎么用?C# Literal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Literal类属于System.Web.UI.WebControls命名空间,在下文中一共展示了Literal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (Post == null)
return;
PageBase page = (PageBase)Page;
PostPanel.CssClass = this.CssClass;
ReplyInfo reply = (ReplyInfo)Post;
msgBody.Text = reply.Message.ReplaceNoParseTags().ParseVideoTags().ParseWebUrls();
litDate.Text = SnitzTime.TimeAgoTag(reply.Date, page.IsAuthenticated, page.Member);
litAuthor.Text = reply.AuthorProfilePopup;
ProfileCommon prof = ProfileCommon.GetUserProfile(reply.AuthorName);
var author = Members.GetAuthor(reply.AuthorId);
if (prof.Gravatar)
{
Gravatar avatar = new Gravatar { Email = author.Email };
if (author.AvatarUrl != "" && author.AvatarUrl.StartsWith("http:"))
avatar.DefaultImage = author.AvatarUrl;
avatar.CssClass = "avatar";
phAvatar.Controls.Add(avatar);
}
else
{
SnitzMembershipUser mu = (SnitzMembershipUser)Membership.GetUser(author.Username);
Literal avatar = new Literal { Text = author.AvatarImg };
if (mu != null && mu.IsActive && !(Config.AnonMembers.Contains(mu.UserName)))
avatar.Text = avatar.Text.Replace("'avatar'", "'avatar online'");
phAvatar.Controls.Add(avatar);
}
}
示例2: navbar
public Literal navbar()
{
Literal nav = new Literal();
nav.Text = "<div class='header'>"
+ "<div class='header-left'>" + "<img src='images/logoUNISON.gif'/></div>"
+ "<div class='header-right'>"
+ "<ul class='nav1'>"
+ "<li><a href='Trsaccion.aspx'>Salidas</a></li>"
+ "<li><a href='AddProducts.aspx'>Entradas</a></li>"
+ "<li><a href='#'>Consultas</a>"
+ "<ul>"
+ "<li><a href='consulta_por_nombre.aspx'>Nombre</a></li>"
+ "<li><a href='consulta_por_codigo.aspx'>Código</a></li>"
+"</ul></li>"
+ "<li><a href='AddModulo.aspx'>Agregar Módulo</a></li>"
+ "<li><a href='agregar_usuario.aspx'>Agregar Personal</a></li>"
+ "<li><a href='Reportes.aspx'>Reportes</a></li>"
+ "<li><a href='index.aspx'>Logout</a></li>"
+ "</ul>"
+ "</div>"
+ "</div>";
return nav;
}
示例3: InstantiateIn
public void InstantiateIn(Control container)
{
Literal l = new Literal();
l.Text = "<div>";
l.DataBinding += new EventHandler(this.BindData);
container.Controls.Add(l);
}
示例4: Fy
/// <summary>
/// 分页
/// </summary>
public static PagedDataSource Fy(PagedDataSource pds, int _pagesize, int _pagenum, string herf, Literal l1, Literal l2, Literal l3, Literal l4, Literal l5, Literal l6, Literal l7, Literal l8, Literal l9, Literal l10)
{
pds.AllowPaging = true;
pds.PageSize = _pagesize;
pds.CurrentPageIndex = _pagenum;
string leftstyle = " width:18px; height:18px; display: inline-block; vertical-align:middle; background: url('/image/fen1.jpg');";
string left = "<a href=\"{0}\" style=\"{1}\"></a>";
string rightstyle = " width:18px; height:18px; display: inline-block; vertical-align:middle; background: url('/image/fen2.jpg');";
string right = "<a href=\"{0}\" style=\"{1}\"></a>";
string mid = "<a href='{0}' class='{1}'>[{2}]</a>";
string midclass = "dl1";
//共多少条/页
if (pds.PageCount != 1)
{
//页数
l1.Text = "共" + pds.DataSourceCount + "条 当前" + (pds.CurrentPageIndex + 1) + "/" + pds.PageCount + "页 ";
if (pds.IsLastPage)
{
l2.Text = String.Format(left, String.Format(herf, (pds.PageCount - 2).ToString()), leftstyle) + " ";
l3.Text = pds.PageCount - 4 > 0 ? String.Format(mid, String.Format(herf, (pds.PageCount - 5).ToString()), midclass, (pds.PageCount - 4).ToString()) : "";
l4.Text = pds.PageCount - 3 > 0 ? String.Format(mid, String.Format(herf, (pds.PageCount - 4).ToString()), midclass, (pds.PageCount - 3).ToString()) : "";
l5.Text = pds.PageCount - 2 > 0 ? String.Format(mid, String.Format(herf, (pds.PageCount - 3).ToString()), midclass, (pds.PageCount - 2).ToString()) : "";
l6.Text = pds.PageCount - 1 > 0 ? String.Format(mid, String.Format(herf, (pds.PageCount - 2).ToString()), midclass, (pds.PageCount - 1).ToString()) : "";
l7.Text = pds.PageCount.ToString();
l8.Text = "";
l9.Text = "";
l10.Text = "";
}
if (pds.IsFirstPage)
{
l2.Text = "";
l3.Text = "1";
l4.Text = pds.CurrentPageIndex + 2 <= pds.PageCount ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 1).ToString()), midclass, (pds.CurrentPageIndex + 2).ToString()) : "";
l5.Text = pds.CurrentPageIndex + 3 <= pds.PageCount ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 2).ToString()), midclass, (pds.CurrentPageIndex + 3).ToString()) : "";
l6.Text = pds.CurrentPageIndex + 4 <= pds.PageCount ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 3).ToString()), midclass, (pds.CurrentPageIndex + 4).ToString()) : "";
l7.Text = pds.CurrentPageIndex + 5 <= pds.PageCount ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 4).ToString()), midclass, (pds.CurrentPageIndex + 5).ToString()) : "";
l8.Text = pds.CurrentPageIndex + 2 <= pds.PageCount ? " " + String.Format(right, String.Format(herf, (pds.CurrentPageIndex + 1).ToString()), rightstyle) : "";
l9.Text = "";
l10.Text = "";
}
if ((!pds.IsFirstPage) && (!pds.IsLastPage))
{
l2.Text = String.Format(left, String.Format(herf, (pds.CurrentPageIndex - 1).ToString()), leftstyle) + " "; ;
l3.Text = (pds.CurrentPageIndex - 2 > 0) ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex - 3).ToString()), midclass, (pds.CurrentPageIndex - 2).ToString()) : "";
l4.Text = (pds.CurrentPageIndex - 1 > 0) ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex - 2).ToString()), midclass, (pds.CurrentPageIndex - 1).ToString()) : "";
l5.Text = pds.CurrentPageIndex > 0 ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex - 1).ToString()), midclass, (pds.CurrentPageIndex).ToString()) : "";
l6.Text = (pds.CurrentPageIndex + 1).ToString();
l7.Text = pds.CurrentPageIndex + 1 < pds.PageCount ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 1).ToString()), midclass, (pds.CurrentPageIndex + 2).ToString()) : "";
l8.Text = (pds.CurrentPageIndex + 2 < pds.PageCount) ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 2).ToString()), midclass, (pds.CurrentPageIndex + 3).ToString()) : "";
l9.Text = (pds.CurrentPageIndex + 3 < pds.PageCount) ? String.Format(mid, String.Format(herf, (pds.CurrentPageIndex + 3).ToString()), midclass, (pds.CurrentPageIndex + 4).ToString()) : "";
l10.Text = " " + String.Format(right, String.Format(herf, (pds.CurrentPageIndex + 1).ToString()), rightstyle);
}
}
return pds;
}
示例5: CreateTextTemplate
public static SimpleFieldTemplateUserControl CreateTextTemplate(MetaColumn column, bool readOnly) {
SimpleFieldTemplateUserControl control = new SimpleFieldTemplateUserControl();
if (readOnly) {
var literal = new Literal();
literal.DataBinding += (sender, e) => {
literal.Text = control.FieldValueString;
};
control.Controls.Add(literal);
}
else {
var textBox = new TextBox();
textBox.DataBinding += (sender, e) => {
textBox.Text = control.FieldValueEditString;
};
// Logic copied from BoundField
if (column.ColumnType.IsPrimitive) {
textBox.Columns = 5;
}
control._valueExtrator = () => textBox.Text;
textBox.CssClass = "DDTextBox";
textBox.ID = TextBoxID;
control.Controls.Add(textBox);
control.CreateValidators(column);
}
return control;
}
示例6: CreateChildControls
protected override void CreateChildControls()
{
Controls.Clear();
Control articleMarkup = Page.LoadControl("~/Design/Article.ascx");
_headerPlaceholder = articleMarkup.FindControl("HeaderPlaceholder") as PlaceHolder;
_contentPlaceholder = articleMarkup.FindControl("ContentPlaceholder") as PlaceHolder;
_headerPlaceholder.Visible = ! String.IsNullOrEmpty(_caption);
if (_headerPlaceholder.Visible)
{
Literal caption = new Literal();
caption.Text = _caption;
_headerPlaceholder.Controls.Add(caption);
}
if (_contentTemplate != null)
{
TemplateContainer container = new TemplateContainer();
_contentTemplate.InstantiateIn(container);
_contentPlaceholder.Controls.Add(container);
}
Controls.Add(articleMarkup);
}
示例7: DataEditorControls
public override Control DataEditorControls(XmlNode xml, Dictionary<string, object> properties)
{
//properties should be multiType properties ie. Name, Description, Mandatory, Validation
Panel pnlDataEditor = new Panel();
Label lblDataEditor = new Label() { Text = properties["Name"].ToString() };
Literal litDescription = new Literal() { Text = properties["Description"].ToString() };
dtpDataEditor = new umbraco.uicontrols.DatePicker.DateTimePicker();
if (properties.ContainsKey("ShowTime"))
{
boolShowTime = bool.Parse(properties["ShowTime"].ToString());
dtpDataEditor.ShowTime = boolShowTime;
}
if (xml != null)
{
//Anything special about the xml? no - just do innertext
dtpDataEditor.DateTime = Convert.ToDateTime(xml.InnerText);
}
pnlDataEditor.Controls.Add(lblDataEditor);
pnlDataEditor.Controls.Add(litDescription);
pnlDataEditor.Controls.Add(dtpDataEditor);
if (xml != null)
{
//Anything special about the xml? no - just do innertext
dtpDataEditor.DateTime = Convert.ToDateTime(xml.InnerText);
}
return pnlDataEditor;
}
开发者ID:benaghaeipour,项目名称:4Ben.DataTypes.MultiType.PropertyTypes,代码行数:34,代码来源:MultiType_DateTimePicker.cs
示例8: InstantiateIn
public void InstantiateIn(Control container)
{
l = new Literal();
l.ID = id;
l.Text = " ";
container.Controls.Add(l);
}
示例9: InitializeSkin
protected override void InitializeSkin(System.Web.UI.Control Skin)
{
//if(Context.Session["PassWord"]==null||Convert.ToString(Context.Session["PassWord"])=="")
//{
// Context.Response.Redirect("Index.aspx?mfiid="+BlogContext.Current.MFiiD+"&afiid="+BlogContext.Current.AFiiD);
//}
//if (Convert.ToString(Context.Session["PassWord"]) != BWeblog_log.GetPW(Convert.ToInt32( Context.Request["logid"])))
//{
// Context.Response.Redirect("Index.aspx?mfiid=" + BlogContext.Current.MFiiD + "&afiid=" + BlogContext.Current.AFiiD);
//}
EnReply = (Panel)Skin.FindControl("EnReply");
ReplyAlert = (Literal)Skin.FindControl("ReplyAlert");
View_WeblogUserLog WL = BWeblog_log.GetByIDAndFiid(blogContext.LogId,blogContext.MFiiD);
if (WL == null)
{
Context.Response.Write("<script>alert('该文章不存在或已经删除!');top.window.location='/" + blogContext.Context.Request.QueryString["Domain"] + "';</script>");
Context.Response.End();
}
if (Convert.ToBoolean(WL.Log_IsEnRePly))
{
EnReply.Visible = true;
ReplyAlert.Visible = false;
}
else
{
EnReply.Visible = false;
ReplyAlert.Visible = true;
}
Globals.UpdateLogByRssLink(blogContext.BlogUserId);
}
示例10: OnPreRender
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
_date = System.DateTime.Now;
if (SelectedDateTime.HasValue)
_date = SelectedDateTime.Value;
if (ShowTime) {
tb_minutes.Columns = 2;
tb_hours.Columns = 2;
tb_hours.Text = _date.Hour.ToString();
tb_minutes.Text = fixTime(_date.Minute);
Literal lit = new Literal();
lit.Text = ":";
this.Controls.Add(tb_hours);
this.Controls.Add(lit);
this.Controls.Add(tb_minutes);
}
tb_date.ID = base.ID + "_datePickField";
this.Controls.Add(tb_date);
AjaxControlToolkit.CalendarExtender cal = new AjaxControlToolkit.CalendarExtender();
cal.TargetControlID = tb_date.UniqueID;
cal.SelectedDate = _date;
this.Controls.Add(cal);
}
示例11: AddReportBody
private void AddReportBody(Panel container)
{
this.reportBody = new Panel();
this.reportBody.ID = "report";
this.header = new ReportHeader();
this.header.Path = ConfigurationHelper.GetReportParameter( "HeaderPath");
this.reportBody.Controls.Add(this.header);
this.reportTitleLiteral = new Literal();
this.reportBody.Controls.Add(this.reportTitleLiteral);
this.topSectionLiteral = new Literal();
this.reportBody.Controls.Add(this.topSectionLiteral);
this.bodyContentsLiteral = new Literal();
this.reportBody.Controls.Add(this.bodyContentsLiteral);
this.gridPlaceHolder = new PlaceHolder();
this.reportBody.Controls.Add(this.gridPlaceHolder);
this.bottomSectionLiteral = new Literal();
this.reportBody.Controls.Add(this.bottomSectionLiteral);
container.Controls.Add(this.reportBody);
}
示例12: GenerateShopControls
//Fill page with dynamic controls showing products in database
private void GenerateShopControls()
{
ArrayList coffeeList = ConnectionClass.GetCoffeeByType("%");
foreach (Coffee coffee in coffeeList)
{
//Create Controls
Panel coffeePanel = new Panel();
Image image = new Image { ImageUrl = coffee.Image, CssClass = "ProductsImage" };
Literal literal = new Literal { Text = "<br />" };
Literal literal2 = new Literal { Text = "<br />" };
Label lblName = new Label { Text = coffee.Name, CssClass = "ProductsName" };
Label lblPrice = new Label { Text = String.Format("{0:0.00}",coffee.Price) + "<br />", CssClass = "ProductsPrice" };
TextBox textBox = new TextBox {ID = coffee.Id.ToString(), CssClass = "ProductsTextBox", Text = "0", Width = 60};
//Add validation so only numbers can be entered into the textfields
var validator = new RegularExpressionValidator
{
ValidationExpression = "^[0-9]*",
ControlToValidate = textBox.ID,
ErrorMessage = "Please enter a number."
};
//Add controls to Panels
coffeePanel.Controls.Add(image);
coffeePanel.Controls.Add(literal);
coffeePanel.Controls.Add(lblName);
coffeePanel.Controls.Add(literal2);
coffeePanel.Controls.Add(lblPrice);
coffeePanel.Controls.Add(textBox);
coffeePanel.Controls.Add(validator);
pnlProducts.Controls.Add(coffeePanel);
}
}
示例13: RazorPageLoad
private void RazorPageLoad()
{
var strOut = NBrightBuyUtils.RazorTemplRender("discountcodes.cshtml", 0, "", null, ControlPath, "config", Utils.GetCurrentCulture(), StoreSettings.Current.Settings());
var lit = new Literal();
lit.Text = strOut;
phData.Controls.Add(lit);
}
示例14: OnInit
override protected void OnInit(EventArgs e)
{
base.OnInit(e);
try
{
#region "load templates"
var t1 = "tools.html";
// Get Display Body
var dataTempl = ModCtrl.GetTemplateData(ModSettings, t1, Utils.GetCurrentCulture(), DebugMode);
// insert page header text
rpData.ItemTemplate = NBrightBuyUtils.GetGenXmlTemplate(dataTempl, ModSettings.Settings(), PortalSettings.HomeDirectory);
}
catch (Exception exc)
{
//display the error on the template (don;t want to log it here, prefer to deal with errors directly.)
var l = new Literal();
l.Text = exc.ToString();
phData.Controls.Add(l);
}
}
示例15: AttachChildControls
protected override void AttachChildControls()
{
this.txtShipTo = (TextBox) this.FindControl("txtShipTo");
this.txtAddress = (TextBox) this.FindControl("txtAddress");
this.txtZipcode = (TextBox) this.FindControl("txtZipcode");
this.txtTelPhone = (TextBox) this.FindControl("txtTelPhone");
this.txtCellPhone = (TextBox) this.FindControl("txtCellPhone");
this.dropRegionsSelect = (RegionSelector) this.FindControl("dropRegions");
this.btnAddAddress = ButtonManager.Create(this.FindControl("btnAddAddress"));
this.btnCancel = ButtonManager.Create(this.FindControl("btnCancel"));
this.btnEditAddress = ButtonManager.Create(this.FindControl("btnEditAddress"));
this.dtlstRegionsSelect = (Common_Address_AddressList) this.FindControl("list_Common_Consignee_ConsigneeList");
this.lblAddressCount = (Literal) this.FindControl("lblAddressCount");
this.btnAddAddress.Click += new EventHandler(this.btnAddAddress_Click);
this.btnEditAddress.Click += new EventHandler(this.btnEditAddress_Click);
this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
this.dtlstRegionsSelect.ItemCommand += new Common_Address_AddressList.CommandEventHandler(this.dtlstRegionsSelect_ItemCommand);
PageTitle.AddSiteNameTitle("我的收货地址", HiContext.Current.Context);
if (!this.Page.IsPostBack)
{
this.lblAddressCount.Text = HiContext.Current.Config.ShippingAddressQuantity.ToString();
this.dropRegionsSelect.DataBind();
this.Reset();
this.btnEditAddress.Visible = false;
this.BindList();
}
}