本文整理汇总了C#中LiteralControl类的典型用法代码示例。如果您正苦于以下问题:C# LiteralControl类的具体用法?C# LiteralControl怎么用?C# LiteralControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LiteralControl类属于命名空间,在下文中一共展示了LiteralControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: writeNaveLink
private void writeNaveLink(Links link)
{
String element = "<a href='" + link.getPath() + "'><div class='nav-item'>" + link.getLinkText() + "</div></a>";
LiteralControl userLink = new LiteralControl(element);
linksPlaceHolder.Controls.Add(userLink);
}
示例2: LoadData
public void LoadData(int ObjectID)
{
if (!Page.IsPostBack)
{
List<BSTerm> terms = BSTerm.GetTerms(TermType);
if (terms.Count > 0)
{
cblCats.DataSource = terms;
cblCats.DataMember = "TermID";
cblCats.DataTextField = "Name";
cblCats.DataValueField = "TermID";
cblCats.DataBind();
}
else
{
LiteralControl lC = new LiteralControl();
lC.Text = Language.Admin["CategoryNotFound"] + "<br><br><a href=\"Categories.aspx?#Add\">" + Language.Admin["AddNewCategory"] + "</a>";
divCats.Controls.Add(lC);
}
if (ObjectID != 0)
{
List<BSTerm> objectTerms = BSTerm.GetTermsByObjectID(ObjectID, TermType);
foreach (BSTerm objectTerm in objectTerms)
{
if (cblCats.Items.FindByValue(objectTerm.TermID.ToString()) != null)
{
cblCats.Items.FindByValue(objectTerm.TermID.ToString()).Selected = true;
}
}
}
}
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
//TO fix the bug related TO Perisan Culture
if (System.Threading.Thread.CurrentThread.CurrentCulture.LCID == 1065)
System.Threading.Thread.CurrentThread.CurrentCulture = new PersianCulture();
// for supported of RTL languages
if (Resources.labels.LangDirection.Equals("rtl", StringComparison.OrdinalIgnoreCase))
{
var lc = new LiteralControl("<link href=\"" + Utils.RelativeWebRoot + "Custom/Themes/Standard/css/rtl.css\" rel=\"stylesheet\" />");
HeadContent.Controls.Add(lc);
}
// needed to make <%# %> binding work in the page header
Page.Header.DataBind();
if (Security.IsAuthenticated)
{
aLogin.InnerText = Resources.labels.logoff;
aLogin.HRef = Utils.RelativeWebRoot + "Account/login.aspx?logoff";
}
else
{
aLogin.HRef = Utils.RelativeWebRoot + "Account/login.aspx";
aLogin.InnerText = Resources.labels.login;
}
}
示例4: writeNavLink
//add the nav links to the placeholder
private void writeNavLink(UserLink link)
{
String element = "<a href='" + link.getPath() + "'><div class='nav-item'>" + link.getTextValue() + "</div></a>";
LiteralControl userLink = new LiteralControl(element);
PlaceHolder1.Controls.Add(userLink);
}
示例5: LoadLottoery
public void LoadLottoery(string DrawNum, string WinNum)
{
lbLottoName.Text = LotteryName;
hlLotto.NavigateUrl = LotteryUrl;
lbDrawNumber.Text = DrawNum;
string[] wNum = WinNum.Split('+');
string[] rdNum = wNum[0].Trim().Split(' ');
LiteralControl lcRed = new LiteralControl();
for (int i = 0; i < rdNum.Length; i++)
{
lcRed.Text += "<span class=\"b b_png b_p2\">" + rdNum[i].Trim() + "</span>";
}
phWinNumRed.Controls.Add(lcRed);
if (WinNum.IndexOf('+') > 0)
{
LiteralControl lcBlue = new LiteralControl();
string[] blNum = wNum[1].Trim().Split(' ');
for (int i = 0; i < blNum.Length; i++)
{
lcBlue.Text += "<span class=\"b b_png b_p1\">" + blNum[i].Trim() + "</span>";
}
phWinNumBlue.Controls.Add(lcBlue);
}
}
示例6: RadGrid1_ItemCreated
public void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridCommandItem)
{
GridCommandItem commandItem = (e.Item as GridCommandItem);
PlaceHolder container = (PlaceHolder)commandItem.FindControl("PlaceHolder1");
Label label = new Label();
label.Text = " ";
container.Controls.Add(label);
for (int i = 65; i <= 65 + 25; i++)
{
LinkButton linkButton1 = new LinkButton();
LiteralControl lc = new LiteralControl(" ");
linkButton1.Text = "" + (char)i;
linkButton1.CommandName = "alpha";
linkButton1.CommandArgument = "" + (char)i;
container.Controls.Add(linkButton1);
container.Controls.Add(lc);
}
LiteralControl lcLast = new LiteralControl(" ");
container.Controls.Add(lcLast);
LinkButton linkButtonAll = new LinkButton();
linkButtonAll.Text = "Tất cả";
linkButtonAll.CommandName = "NoFilter";
container.Controls.Add(linkButtonAll);
}
}
示例7: LoadWidget
public override void LoadWidget()
{
StringDictionary settings = GetSettings();
int numberOfPosts = DEFAULT_NUMBER_OF_POSTS;
if (settings.ContainsKey("numberofposts"))
numberOfPosts = int.Parse(settings["numberofposts"]);
if (HttpRuntime.Cache["widget_recentposts"] == null)
{
List<Post> visiblePosts = Post.Posts.FindAll(delegate(Post p)
{
return p.IsVisibleToPublic;
});
int max = Math.Min(visiblePosts.Count, numberOfPosts);
List<Post> list = visiblePosts.GetRange(0, max);
HttpRuntime.Cache.Insert("widget_recentposts", list);
}
string content = RenderPosts((List<Post>)HttpRuntime.Cache["widget_recentposts"], settings);
LiteralControl html = new LiteralControl(content); //new LiteralControl((string)HttpRuntime.Cache["widget_recentposts"]);
phPosts.Controls.Add(html);
}
示例8: PopulateWebPageObject
private static void PopulateWebPageObject(SourceWebPage pageObject, CSClass classObject)
{
pageObject.ClassFullName = classObject.ClassFullName;
foreach (var fieldObject in classObject.FieldList)
{
switch (fieldObject.TypeFullName)
{
case "System.Web.UI.WebControls.Literal":
{
var control = new LiteralControl
{
FieldName = fieldObject.FieldName,
ClassName = fieldObject.TypeName,
NamespaceName = fieldObject.TypeNamespace
};
pageObject.Controls.Add(control);
}
break;
default:
{
var control = new SourceWebControl()
{
FieldName = fieldObject.FieldName,
ClassName = fieldObject.TypeName,
NamespaceName = fieldObject.TypeNamespace
};
pageObject.Controls.Add(control);
}
break;
}
}
}
示例9: LoadWidget
public override void LoadWidget()
{
StringDictionary settings = GetSettings();
int numberOfComments = DEFAULT_NUMBER_OF_COMMENTS;
if (settings.ContainsKey("numberofcomments"))
numberOfComments = int.Parse(settings["numberofcomments"]);
if (HttpRuntime.Cache["widget_recentcomments"] == null)
{
List<Comment> comments = new List<Comment>();
foreach (Post post in Post.Posts)
{
if (post.IsVisible)
{
comments.AddRange(post.Comments.FindAll(delegate(Comment c) { return c.IsApproved && c.Email.Contains("@"); }));
}
}
comments.Sort();
comments.Reverse();
int max = Math.Min(comments.Count, numberOfComments);
List<Comment> list = comments.GetRange(0, max);
HttpRuntime.Cache.Insert("widget_recentcomments", list);
}
string content = RenderComments((List<Comment>)HttpRuntime.Cache["widget_recentcomments"], settings);
LiteralControl html = new LiteralControl(content); //new LiteralControl((string)HttpRuntime.Cache["widget_recentcomments"]);
phPosts.Controls.Add(html);
}
示例10: CargarCarusel
private void CargarCarusel()
{
List<EntPelicula> lst = new List<EntPelicula>();
lst = new BusPelicula().ObtenerEstrenos();
LiteralControl literal = new LiteralControl();
LiteralControl literal2 = new LiteralControl();
literal.Text = "";
literal2.Text = "";
int contador = 0;
foreach (EntPelicula ent in lst)
{
if (contador == 0)
literal.Text += " <li data-target=\"#myCarousel\" data-slide-to=\"" + contador + "\" class=\"active\"></li>";
else
literal.Text += " <li data-target=\"#myCarousel\" data-slide-to=\"" + contador + "\" ></li>";
if (contador == 0)
literal2.Text += "<div class=\"item active\">";
else
literal2.Text += "<div class=\"item\">";
literal2.Text += " <img src=\"" + ent.FotoPortada + "\" style=\"margin: auto\" />";
literal2.Text += " </div>";
contador++;
}
phSliderUno.Controls.Add(literal);
phSliderDos.Controls.Add(literal2);
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// for supported of RTL languages
if (Resources.labels.LangDirection.Equals("rtl", StringComparison.OrdinalIgnoreCase))
{
var lc = new LiteralControl("<link href=\"/themes/standard/include/rtl.css\" rel=\"stylesheet\" />");
HeadContent.Controls.Add(lc);
}
// needed to make <%# %> binding work in the page header
Page.Header.DataBind();
if (!Utils.IsMono)
{
var lc = new LiteralControl("\n<!--[if lt IE 9]>" +
"\n<script type=\"text/javascript\" src=\"/themes/standard/include/html5.js\"></script>" +
"\n<![endif]-->\n");
HeadContent.Controls.Add(lc);
}
if (Security.IsAuthenticated)
{
aLogin.InnerText = Resources.labels.logoff;
aLogin.HRef = Utils.RelativeWebRoot + "Account/login.aspx?logoff";
}
else
{
aLogin.HRef = Utils.RelativeWebRoot + "Account/login.aspx";
aLogin.InnerText = Resources.labels.login;
}
}
示例12: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
con.ConnectionString = ConfigurationManager.ConnectionStrings["la"].ConnectionString;
con.Open();
s = "Select * from questions where q_id=" +Request.QueryString["q_id"];
dr = new SqlDataAdapter(s,con);
dr.Fill(ds);
s = ds.Tables[0].Rows[0]["title"].ToString();
category_title.Text = s;
s = ds.Tables[0].Rows[0]["q_body"].ToString();
textDisplay.Text = s;
pdate.Text = "post date: " + ds.Tables[0].Rows[0]["postdate"].ToString();
Author.Text = "posted by: " + ds.Tables[0].Rows[0]["u_name"].ToString();
n = (int)ds.Tables[0].Rows[0]["q_id"];
s = "Select * from answers where q_id=" + n;
commentscmd = new SqlCommand(s,con);
commentReader=commentscmd.ExecuteReader();
while (commentReader.Read())
{
LiteralControl t = new LiteralControl(commentReader["ans_body"].ToString());
Label l = new Label(),l2=new Label();
l.Text = commentReader["u_name"].ToString()+":";
l.Style.Add("font-family", "Arial Black");
l.Style.Add("font-style", "italic");
l.Style.Add("font-weight", "bold");
ph.Controls.Add(l);
ph.Controls.Add(new LiteralControl("<br />"));
ph.Controls.Add(t);
ph.Controls.Add(new LiteralControl("<hr size=\"2pt\" />"));
}
con.Close();
}
示例13: cargarcarrucel2
public void cargarcarrucel2()
{
List<entPelicula> lst = new List<entPelicula>();
lst = new busPelicula().ObtenerEstrenos();
LiteralControl literalTres = new LiteralControl();
LiteralControl literalCua = new LiteralControl();
literalTres.Text = "";
literalCua.Text = "";
int contador = 0;
foreach (entPelicula ent in lst)
{
if (contador == 0)
literalTres.Text += "<li data-target=\"#carouselUno\" data-slide-to=\"" + contador + "\" class=\"active\"></li>";
else
literalTres.Text += "<li data-target=\"#carouselUno\" data-slide-to=\"" + contador + "\"></li>";
if (contador == 0)
literalCua.Text += "<div class=\"item active\">";
else
literalCua.Text += "<div class=\"item\">";
literalCua.Text += " <img src=\"" + ent.FotoPortada + "\" style=\"height:200px; width:400px; margin:auto;\"/>";
literalCua.Text += " <span class=\"style\"><strong>" + ent.Nombre + "</strong></span>";
literalCua.Text += " <div class=\"carousel-caption\">";
literalCua.Text += " </div>";
literalCua.Text += "</div>";
contador++;
}
ph1.Controls.Add(literalTres);
ph2.Controls.Add(literalCua);
}
示例14: CreateButton_OnClick
protected void CreateButton_OnClick(object sender, EventArgs e)
{
MembershipCreateStatus userStatus;
Membership.CreateUser(UserNameText.Text, PassText.Text, EmailText.Text, QuestionText.Text, AnswerText.Text, ActiveUser.Checked,
out userStatus);
if (userStatus == MembershipCreateStatus.Success)
{
foreach (var control in CheckBoxRoles.Controls)
{
if (control is CheckBox)
{
CheckBox box = (CheckBox)control;
if (box.Checked)
{
System.Web.Security.Roles.AddUserToRole(UserNameText.Text, box.ID);
}
}
}
//additionally add userID to user_info table
Activation.addToUserInfoTable(UserNameText.Text);
UserNameText.Text = "";
PassText.Text = "";
PassConfirmText.Text = "";
EmailText.Text = "";
QuestionText.Text = "";
AnswerText.Text = "";
foreach (var control in CheckBoxRoles.Controls)
{
if (control is CheckBox)
{
CheckBox box = (CheckBox)control;
box.Checked = false;
}
}
LiteralControl literalControl = new LiteralControl("<p>User Successfully Added.</p>");
PopUpText.Controls.Add(literalControl);
CreateButton_ModalPopupExtender.Show();
}
else if (userStatus == MembershipCreateStatus.InvalidPassword)
{
LiteralControl literalControl = new LiteralControl("<p>Password must be a minimum of 6 characters.</p>");
PopUpText.Controls.Add(literalControl);
CreateButton_ModalPopupExtender.Show();
}
else if (userStatus == MembershipCreateStatus.DuplicateUserName)
{
LiteralControl literalControl = new LiteralControl("<p>This username is already in use.</p>");
PopUpText.Controls.Add(literalControl);
CreateButton_ModalPopupExtender.Show();
}
}
示例15: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
StreamReader sr = new StreamReader(MapPath(sSERVICES));
string sFloat = "floatLeft";
if (User.Identity.IsAuthenticated)
{
LiteralControl lcTemp = new LiteralControl("<br />");
services.Controls.Add(lcTemp);
Button btnAddService = new Button();
btnAddService.PostBackUrl = "http://www.fordscleaning.com/admin/AddEditService.aspx";
btnAddService.UseSubmitBehavior = false;
btnAddService.CausesValidation = false;
btnAddService.Text = "Add New Service";
btnAddService.ID = "btnAddeNewService";
services.Controls.Add(btnAddService);
}
LiteralControl lc = new LiteralControl("<br /><table width=\"100%\">");
services.Controls.Add(lc);
int iX = 0;
while (!sr.EndOfStream)
{
string sServiceAnchor = sr.ReadLine();
string sServiceName = sr.ReadLine();
string sServiceImage = sr.ReadLine();
string sServiceSummary = sr.ReadLine();
lc = new LiteralControl("<tr><td><div class=\"serviceTitle\"><table width=\"100%\"><tr><td><a style=\"color:#ffffff;\" href=\"http://www.fordscleaning.com/Service.aspx?sid=" + sServiceAnchor + "\" name=\"" + sServiceAnchor + "\">" + sServiceName + "</a></td><td style=\"text-align:right;\">");
services.Controls.Add(lc);
if (User.Identity.IsAuthenticated)
{
Button btnEdit = new Button();
btnEdit.Text = "Edit";
btnEdit.UseSubmitBehavior = false;
btnEdit.CausesValidation = false;
btnEdit.ID = "Edit" + sServiceAnchor;
btnEdit.PostBackUrl = "http://www.fordscleaning.com/admin/AddEditService.aspx?Service=" + iX;
services.Controls.Add(btnEdit);
}
lc = new LiteralControl("</td></tr></table></div>");
services.Controls.Add(lc);
if (sServiceImage != "No Image.")
{
Image img = new Image();
img.ImageUrl = "http://www.fordscleaning.com/MakeThumbnail.aspx?Image=ServiceImages/" + sServiceImage + "&Size=250";
img.CssClass = sFloat;
services.Controls.Add(img);
}
lc = new LiteralControl("      " + sServiceSummary + "</td></tr>");
services.Controls.Add(lc);
if (sFloat == "floatLeft")
sFloat = "floatRight";
else
sFloat = "floatLeft";
iX++;
}
lc = new LiteralControl("</table>");
services.Controls.Add(lc);
sr.Close();
}