本文整理汇总了C#中System.Web.UI.LiteralControl类的典型用法代码示例。如果您正苦于以下问题:C# LiteralControl类的具体用法?C# LiteralControl怎么用?C# LiteralControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LiteralControl类属于System.Web.UI命名空间,在下文中一共展示了LiteralControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindWeblogListContent
protected void BindWeblogListContent(Control control, IDataItemContainer dataItemContainer)
{
WeblogData blogName = new WeblogData();
blogName.Property = "Name";
blogName.Tag = WrappedControlTag.B;
blogName.LinkTo = WeblogLinkTo.HomePage;
control.Controls.Add(blogName);
control.Controls.Add(new LiteralControl("<br />"));
WeblogData postCount = new WeblogData();
postCount.Property = "PostCount";
control.Controls.Add(postCount);
LiteralControl postText = new LiteralControl(" Posts | ");
control.Controls.Add(postText);
WeblogData commentCount = new WeblogData();
commentCount.Property = "CommentCount";
control.Controls.Add(commentCount);
LiteralControl commentText = new LiteralControl(" Comments");
control.Controls.Add(commentText);
control.Controls.Add(new LiteralControl("<br />"));
}
示例2: Render
protected override void Render(HtmlTextWriter writer)
{
var headControl = Page.Header;
if (headControl == null)
{
base.Render(writer);
return;
}
try
{
var hrefSchemeAndServerPart = PortalContext.Current.OriginalUri.GetComponents(UriComponents.SchemeAndServer, UriFormat.SafeUnescaped);
var hrefPathPart = PortalContext.Current.OriginalUri.GetComponents(UriComponents.Path, UriFormat.SafeUnescaped);
hrefSchemeAndServerPart = VirtualPathUtility.AppendTrailingSlash(hrefSchemeAndServerPart);
var hrefString = String.Concat(hrefSchemeAndServerPart, hrefPathPart);
//note that if the original URI already contains a trailing slash, we do not remove it
if (AppendTrailingSlash)
hrefString = VirtualPathUtility.AppendTrailingSlash(hrefString);
var baseTag = new LiteralControl
{
ID = "baseTag",
Text = String.Format("<base href=\"{0}\" />", hrefString)
};
baseTag.RenderControl(writer);
}
catch (Exception exc) //logged
{
Logger.WriteException(exc);
}
}
示例3: Page_Init_InitialLoading
protected void Page_Init_InitialLoading(object sender, ActiveEventArgs e)
{
Page page = HttpContext.Current.Handler as Page;
// Injecting a CSS link reference if additional CSS files are to be included
string custFiles = Settings.Instance["CustomCssFiles"];
if (!string.IsNullOrEmpty(custFiles))
{
string[] files = custFiles.Split(
new char[] { ',' },
StringSplitOptions.RemoveEmptyEntries);
foreach (string file in files)
{
string fileName = file.Trim();
LiteralControl lit = new LiteralControl();
lit.Text = string.Format(@"
<link
href=""{0}""
rel=""stylesheet""
type=""text/css"" />",
fileName);
page.Header.Controls.Add(lit);
}
}
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
LiteralControl litcon01 = new LiteralControl();
litcon01.Text += "<h1>nbl_WC_Close-Coupled</h1>";
model01_title.Controls.Add(litcon01);
LiteralControl litcon02 = new LiteralControl();
litcon02.Text += "<h1>nbl_WashFountain</h1>";
model02_title.Controls.Add(litcon02);
LiteralControl litcon03 = new LiteralControl();
litcon03.Text += "<h1>nbl_WashBasin_Pedestal</h1>";
model03_title.Controls.Add(litcon03);
LiteralControl litcon04 = new LiteralControl();
litcon04.Text += "<h1>nbl_Sink_Belfast</h1>";
model04_title.Controls.Add(litcon04);
LiteralControl litcon05 = new LiteralControl();
litcon05.Text += "<h1>nbl_Shower_Rctngl</h1>";
model05_title.Controls.Add(litcon05);
LiteralControl litcon06 = new LiteralControl();
litcon06.Text += "<h1>nbl_SanitaryAccessory_Hand-Drier</h1>";
model06_title.Controls.Add(litcon06);
}
示例5: cbUpgrade_Callback
private void cbUpgrade_Callback(object sender, Controls.CallBackEventArgs e)
{
string upFilePath = Server.MapPath("~/desktopmodules/activeforums/upgrade4x.txt");
string err = "Success";
try
{
if (System.IO.File.Exists(upFilePath))
{
string s = Utilities.GetFileContent(upFilePath);
err = DotNetNuke.Entities.Portals.PortalSettings.ExecuteScript(s);
System.IO.File.Delete(upFilePath);
}
}
catch (Exception ex)
{
if (ex is UnauthorizedAccessException && string.IsNullOrEmpty(err))
{
err = "<span style=\"font-size:14px;font-weight:bold;\">The forum data was upgraded successfully, but you must manually delete the following file:<br /><br />" + upFilePath + "<br /><br />The upgrade is not complete until you delete the file indicated above.</span>";
}
else
{
err = "<span style=\"font-size:14px;font-weight:bold;\">Upgrade Failed - Please go to the <a href=\"http://www.activemodules.com/community/helpdesk.aspx\">Active Modules Help Desk</a> to report the error indicated below:<br /><br />" + ex.Message + "</span>";
}
}
LiteralControl lit = new LiteralControl();
if (string.IsNullOrEmpty(err))
{
err = "<script type=\"text/javascript\">LoadView('home');</script>";
}
lit.Text = err;
lit.RenderControl(e.Output);
}
示例6: Alert
public Alert()
: base("div")
{
Closable = true;
closeButton = new LiteralControl("<button type=\"button\" class=\"close\" data-dismiss=\"alert\">×</button>");
textLiteral = new LiteralControl();
}
示例7: SetupLinks
private void SetupLinks()
{
Panel pnlContent = botnavcontent;
HyperLink linkToAdd;
LiteralControl space;
for (Int32 i = 0; i < pageNames.Length; i++)
{
linkToAdd = new HyperLink();
linkToAdd.NavigateUrl = pageLinks[i];
linkToAdd.Text = linkText[i];
if (Page.Request.Url.ToString().ToLower().Contains(pageNames[i]))
{
linkToAdd.Attributes.Add("class", "unavon");
}
pnlContent.Controls.Add(linkToAdd);
if (i < (pageNames.Length - 1))
{
space = new LiteralControl();
space.Text = " | ";
pnlContent.Controls.Add(space);
}
}
}
示例8: magix_forms_controls_panel
private void magix_forms_controls_panel(object sender, ActiveEventArgs e)
{
Node ip = Ip(e.Params);
if (ShouldInspect(ip))
{
Inspect(ip);
return;
}
LiteralControl ctrl = new LiteralControl();
Node node = ip["_code"].Get<Node>();
string idPrefix = "";
if (ip.ContainsValue("id-prefix"))
idPrefix = ip["id-prefix"].Get<string>();
if (node.ContainsValue("id"))
ctrl.ID = idPrefix + node["id"].Get<string>();
else if (node.Value != null)
ctrl.ID = idPrefix + node.Get<string>();
if (node.ContainsValue("text"))
ctrl.Text = node["text"].Get<string>();
ip["_ctrl"].Value = ctrl;
}
示例9: Show
public static void Show(System.Web.UI.Page p, object mess)
{
//HttpContext.Current.Response.Write("<script>alert('"+mess.ToString()+"')</script>");
System.Web.UI.LiteralControl lt = new System.Web.UI.LiteralControl();
lt.Text= "<script language=\"javascript\" type=\"text/javascript\"> alert(\"" + mess.ToString() + "\")</script>";
p.Header.Controls.Add(lt);
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
NameValueCollection nvc = Request.Form;
LiteralControl lt = new LiteralControl();
this.Controls.Add(lt);
if (string.IsNullOrEmpty(nvc[AzureContract.PushNotificationPost.TITLE]) ||
string.IsNullOrEmpty(nvc[AzureContract.PushNotificationPost.CONTENT]) ||
string.IsNullOrEmpty(nvc[AzureContract.PushNotificationPost.SUBSCRIPTION_URI]) ||
string.IsNullOrEmpty(nvc[AzureContract.PushNotificationPost.NAVIGATION_URI]))
{
lt.Text = "Error, one of the required post fields is empty.\n"+nvc[AzureContract.PushNotificationPost.TITLE]+"\n"+nvc[AzureContract.PushNotificationPost.CONTENT]+"\n"+nvc[AzureContract.PushNotificationPost.SUBSCRIPTION_URI]+"\n"+nvc[AzureContract.PushNotificationPost.NAVIGATION_URI];
return;
}
string title, content, subscriptionUri, navigationUri;
title = nvc[AzureContract.PushNotificationPost.TITLE];
content = nvc[AzureContract.PushNotificationPost.CONTENT];
subscriptionUri = nvc[AzureContract.PushNotificationPost.SUBSCRIPTION_URI];
navigationUri = nvc[AzureContract.PushNotificationPost.NAVIGATION_URI];
lt.Text = "Toast title:" + title + "\ncontent:" + content + "\nnavigation uri:" + navigationUri + "\nphone uri:" + subscriptionUri;
sendPushNotification(subscriptionUri, title, content, navigationUri);
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e) {
lnkAddUpSell.Click += new EventHandler(lnkAddUpSell_Click);
i = 1;
while (i <= upSellProducts) {
TextBox txt = new TextBox();
txt.ID = "txtUpSellAddition" + i;
plhUpSellAdditions.Controls.Add(txt);
CustomValidator upCustomValidator = new CustomValidator();
upCustomValidator.ControlToValidate = txt.ID;
upCustomValidator.Enabled = true;
upCustomValidator.EnableViewState = true;
upCustomValidator.SetFocusOnError = true;
upCustomValidator.Text = "This is not a valid product";
upCustomValidator.ErrorMessage = "A upsell product you added is invlaid.";
upCustomValidator.ServerValidate += RelatedProductValidation;
plhUpSellAdditions.Controls.Add(upCustomValidator);
LiteralControl l = new LiteralControl();
l.Text = "<br/><br/>";
plhUpSellAdditions.Controls.Add(l);
i++;
}
if (product.UpSellList.Count > 0) {
rptUpSell.DataSource = product.UpSellList;
rptUpSell.DataBind();
}
}
示例12: Page_Init
protected static void Page_Init(object sender, ActiveEventArgs e)
{
Page page = HttpContext.Current.Handler as Page;
if (page != null)
{
if(!page.IsPostBack)
{
// Inject the Google Analytics tracking code...
string trackingID = Settings.Instance["GoogleAnalyticsTrackingID"];
if(!string.IsNullOrEmpty(trackingID))
{
string trackingCode = string.Format(@"
<script type=""text/javascript"">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{0}']);
_gaq.push(['_trackPageview']);
(function() {{
var ga = document.createElement('script');
ga.src = ('https:' == document.location.protocol ?
'https://ssl' : 'http://www') +
'.google-analytics.com/ga.js';
ga.setAttribute('async', 'true');
document.documentElement.firstChild.appendChild(ga);
}})();
</script>", trackingID);
LiteralControl ctrl = new LiteralControl();
ctrl.Text = trackingCode;
page.Form.Controls.Add(ctrl);
}
}
}
}
示例13: AddCustomCodeToHead
protected virtual void AddCustomCodeToHead()
{
// Adds code in ThonSettings.Instance.HtmlHeader to the head of the page
string code = string.Format("{0}<!-- Start custom code -->{0}{1}{0}<!-- End custom code -->{0}", Environment.NewLine, ThonSettings.Instance.HtmlHeader);
LiteralControl control = new LiteralControl(code);
Page.Header.Controls.Add(control);
}
示例14: InstantiateIn
//must implement following method
public void InstantiateIn(Control container)
{
LiteralControl l = new LiteralControl();
l.DataBinding +=
new EventHandler(this.OnDataBinding);
container.Controls.Add(l);
}
示例15: BindPageList
private void BindPageList()
{
foreach (Page page in BlogEngine.Core.Page.Pages)
{
if (!page.HasParentPage)
{
HtmlGenericControl li = new HtmlGenericControl("li");
HtmlAnchor a = new HtmlAnchor();
a.HRef = "?id=" + page.Id.ToString();
a.InnerHtml = page.Title;
System.Web.UI.LiteralControl text = new System.Web.UI.LiteralControl
(" (" + page.DateCreated.ToString("yyyy-dd-MM HH:mm") + ")");
li.Controls.Add(a);
li.Controls.Add(text);
if (page.HasChildPages)
{
li.Controls.Add(BuildChildPageList(page));
}
li.Attributes.CssStyle.Remove("font-weight");
li.Attributes.CssStyle.Add("font-weight", "bold");
ulPages.Controls.Add(li);
}
}
divPages.Visible = true;
aPages.InnerHtml = BlogEngine.Core.Page.Pages.Count + " " + Resources.labels.pages;
}