• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# LiteralControl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中LiteralControl的典型用法代码示例。如果您正苦于以下问题:C# LiteralControl类的具体用法?C# LiteralControl怎么用?C# LiteralControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LiteralControl类属于命名空间,在下文中一共展示了LiteralControl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
    }
开发者ID:craig-smith,项目名称:CISSeniorProjectFinal,代码行数:7,代码来源:LinksControl.ascx.cs


示例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;
                    }
                }
            }
        }
    }
开发者ID:Blogsa,项目名称:blogsa,代码行数:33,代码来源:Categories.ascx.cs


示例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;
        }
    }
开发者ID:ildragocom,项目名称:BlogEngine.NET,代码行数:26,代码来源:site.master.cs


示例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);
    }
开发者ID:craig-smith,项目名称:CISSeniorProjectTest,代码行数:8,代码来源:WebUserControl.ascx.cs


示例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);
     }
 }
开发者ID:ichari,项目名称:ichari,代码行数:25,代码来源:LastestDrawing.ascx.cs


示例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 = "&nbsp;&nbsp;";

            container.Controls.Add(label);

            for (int i = 65; i <= 65 + 25; i++)
            {
                LinkButton linkButton1 = new LinkButton();

                LiteralControl lc = new LiteralControl("&nbsp;&nbsp;");

                linkButton1.Text = "" + (char)i;

                linkButton1.CommandName = "alpha";
                linkButton1.CommandArgument = "" + (char)i;

                container.Controls.Add(linkButton1);
                container.Controls.Add(lc);
            }

            LiteralControl lcLast = new LiteralControl("&nbsp;");
            container.Controls.Add(lcLast);

            LinkButton linkButtonAll = new LinkButton();
            linkButtonAll.Text = "Tất cả";
            linkButtonAll.CommandName = "NoFilter";
            container.Controls.Add(linkButtonAll);
        }
    }
开发者ID:hungtien408,项目名称:web-quanaotreem,代码行数:35,代码来源:manufacturer1.aspx.cs


示例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);
    }
开发者ID:TrueSystems,项目名称:SitesWEB,代码行数:25,代码来源:widget.ascx.cs


示例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;
				}
			}
		}
开发者ID:mmooney,项目名称:MMDB.UITest,代码行数:32,代码来源:ProxyGenerator.cs


示例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);
    }
开发者ID:rajgit31,项目名称:RajBlog,代码行数:32,代码来源:widget.ascx.cs


示例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);
    }
开发者ID:LUISMTZLOPEZ,项目名称:Peliculas,代码行数:31,代码来源:Pelic.aspx.cs


示例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;
        }
    }
开发者ID:jinthakur,项目名称:codeforfirstworld,代码行数:29,代码来源:site.master.cs


示例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();
 }
开发者ID:vigneshjathavara,项目名称:CS-JUNCTION,代码行数:35,代码来源:QDisplay.aspx.cs


示例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);
    }
开发者ID:JJUAN22,项目名称:Peliculas,代码行数:35,代码来源:Default.aspx.cs


示例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();
        }
    }
开发者ID:btevfik,项目名称:Fuddle,代码行数:59,代码来源:CreateUser.aspx.cs


示例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("&nbsp &nbsp &nbsp " + 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();
    }
开发者ID:chevex-archived,项目名称:FordsCleaning,代码行数:59,代码来源:OurServices.aspx.cs


示例16: printViewItem

    private void printViewItem(InventoryItem item)
    {
        InventoryHtmlPrinter printer = new InventoryHtmlPrinter(item);
        String itemHtml = printer.getViewItemHtml(item);

        LiteralControl control = new LiteralControl(itemHtml);
        productsPlaceHolder.Controls.Add(control);
    }
开发者ID:craig-smith,项目名称:CISSeniorProjectFinal,代码行数:8,代码来源:products.aspx.cs


示例17: getLinks

 private void getLinks(int lastItemNumber, int firstItem)
 {
     List<int> itemIds = InventoryManager.getTotalItems();
     InventoryHtmlPrinter printer = new InventoryHtmlPrinter();
     String links = printer.getInventoryLinkHTML(lastItemNumber, firstItem, itemIds);
     LiteralControl control = new LiteralControl(links);
     productsLinksPlaceHolder.Controls.Add(control);
 }
开发者ID:craig-smith,项目名称:CISSeniorProjectFinal,代码行数:8,代码来源:products.aspx.cs


示例18: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Id"] == null) Response.Redirect("Logon.aspx");
        string Iduser =  Convert.ToString(Session["Id"]);
        Label1.Visible = false;
        try
        {
            conexao = new MySqlConnection("server=localhost; port=3306; user id=root; password=root; database= lojaonline");
            conexao.Open();

            string sql = "SELECT produtos.*, comprasefetuadas.* from produtos INNER JOIN comprasefetuadas ON produtos.idprod=comprasefetuadas.idproduto WHERE [email protected] ORDER BY produtos.nomeprod";

            stm = new MySqlCommand(sql, conexao);
            stm.Parameters.AddWithValue("@id", Iduser);
            stm.Prepare();

            dr = stm.ExecuteReader();

            String strHTML = "";
            if (dr.HasRows)
            { //mostramos o cabeçalho da <table> somente se temos registros
                strHTML = "<TABLE name=produts border=1 width='65%'> <TR style='font-size: 14px; font-family: verdana; text-align: center; font-weight: 900; color: #009;'>"
                    + "<TD>&nbsp;Código&nbsp;</TD><TD style='text-align: left'>&nbsp;Nome&nbsp;</TD>"
                    + "<TD>&nbsp;Preço&nbsp;</TD><TD>&nbsp;Quantidade&nbsp;</TD></TR>";
            }
            else
            {
                Label1.Visible = true;
                Label1.Text = "Este usuário não comprou produtos ainda nesta loja on-line";
            }

            while (dr.Read())
            {
                String codigo = dr.GetString("idprod");
                String nome = dr.GetString("nomeprod");
                String preco = dr.GetString("preco");
                String qtde = dr.GetString("qtdecomprada");
                strHTML += "<TR><TD style='font-size: 12px; font-family: verdana; text-align: center;'>" + codigo
                        + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: left;'>&nbsp;&nbsp;"
                        + nome + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: center;'>"
                        + preco + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: center;'>"
                        + qtde + "</TD></TR>";
            }

            strHTML += "</TABLE> <br/><br/><br/>";
            LiteralControl lc = new LiteralControl(strHTML);
            Panel1.Controls.Add(lc);
            stm.Dispose();
            dr.Close();
            conexao.Close();
        }
        catch (Exception exc)
        {
            Label1.Visible = true;
            Label1.Text = "Erro no processamento do BD - " + exc.Message;
        }

    }
开发者ID:rodrigogregorioneri,项目名称:Projetos-e-exercicios-faculdade,代码行数:58,代码来源:Comprados.aspx.cs


示例19: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
       
        con.ConnectionString = ConfigurationManager.ConnectionStrings["la"].ConnectionString;
        con.Open();
        s = "Select * from articles where title='" +Request.QueryString["title"]+"'";
        dr = new SqlDataAdapter(s,con);
        dr.Fill(ds);
        s = ds.Tables[0].Rows[0]["title"].ToString();
        category_title.Text = s;
        Page.Title = s;
        s = ds.Tables[0].Rows[0]["a_body"].ToString();
        textDisplay.Text = s;
        
        pdate.Text = "post date: " + ds.Tables[0].Rows[0]["postdate"].ToString();

        rs = "SELECT SUM(rating) As RatingSum, COUNT(*) As RatingCount FROM ratings WHERE a_id=" + (int)ds.Tables[0].Rows[0]["a_id"];
        rdr = new SqlDataAdapter(rs, con);
        rdr.Fill(rds);
        if ((int)rds.Tables[0].Rows[0]["RatingCount"] == 0)
        {
            rating.Text = "RATING: not rated";
            Image1.Visible = false;
        }
        else
        {
            rating.Text = "RATING:" + (int)rds.Tables[0].Rows[0]["RatingSum"] / (int)rds.Tables[0].Rows[0]["RatingCount"];
            Image1.Visible = true;
        }
        Author.Text = "posted by: " + ds.Tables[0].Rows[0]["u_name"].ToString();
        n = (int)ds.Tables[0].Rows[0]["a_id"];
        s = "Select * from comments where a_id=" + n;
        commentscmd = new SqlCommand(s,con);
        commentReader=commentscmd.ExecuteReader();
        while (commentReader.Read())
        {
            LiteralControl t = new LiteralControl(commentReader["co_body"].ToString());
            Label l = new Label(),l2=new Label();
            Button b = new Button();
            b.ID = commentReader["co_id"].ToString();
            b.Click+=new EventHandler(b_Click);
            b.Text = "Report abuse";
            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");
            l2.ID = commentReader["co_id"].ToString()+"l";
            ph.Controls.Add(l);
            ph.Controls.Add(b);
            ph.Controls.Add(l2);
            ph.Controls.Add(new LiteralControl("<br />"));
            ph.Controls.Add(t);
            ph.Controls.Add(new LiteralControl("<hr size=\"2pt\" />"));
           
           
        }
        con.Close();
    }
开发者ID:vigneshjathavara,项目名称:CS-JUNCTION,代码行数:58,代码来源:ArticleDisplay.aspx.cs


示例20: LoadWidget

 /// <summary>
 /// This method works as a substitute for Page_Load. You should use this method for
 /// data binding etc. instead of Page_Load.
 /// </summary>
 public override void LoadWidget()
 {
     StringDictionary settings = GetSettings();
     if (settings.ContainsKey("content"))
     {
         LiteralControl text = new LiteralControl(settings["content"]);
         this.Controls.Add(text);
     }
 }
开发者ID:bpanjavan,项目名称:Blog,代码行数:13,代码来源:widget.ascx.cs



注:本文中的LiteralControl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LiteralExpressionSyntax类代码示例发布时间:2022-05-24
下一篇:
C# Literal类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap