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

C# Literal类代码示例

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

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



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


示例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;
    }
开发者ID:jasonhuber,项目名称:2012JULY,代码行数:29,代码来源:Week2.aspx.cs


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


示例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
        {

        }

    }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:30,代码来源:POP_CAA111.aspx.cs


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


示例6: GetValue

        protected override string GetValue(Literal literal)
        {
            if (literal == null)
                throw new ArgumentNullException(nameof(literal));

            return literal.Identifier;
        }
开发者ID:JosefPihrt,项目名称:SnippetManager,代码行数:7,代码来源:LiteralIdentifierComparer.cs


示例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);
        }
开发者ID:veraveramanolo,项目名称:power-show,代码行数:27,代码来源:cs_templates_item.aspx.cs


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


示例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());
     }
 }
开发者ID:WFPVAM,项目名称:GRASPReporting,代码行数:41,代码来源:IncomingProcessor.cs


示例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);
            }
        }
开发者ID:JohnStov,项目名称:fixie,代码行数:26,代码来源:ObjectExtensions.cs


示例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;
    }
开发者ID:ssommerfeldt,项目名称:TAC_WWW,代码行数:26,代码来源:WebInfoDotNet.ascx.cs


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


示例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 + "&amp;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);
 }
开发者ID:ronanb67,项目名称:timeflies,代码行数:7,代码来源:MyVideos.aspx.cs


示例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++;
                    }
                }
            }
        }
    }
开发者ID:BGCX261,项目名称:zhenzhuo-px-svn-to-git,代码行数:33,代码来源:GridTeachers.ascx.cs


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


示例16: LoadPage

    protected void LoadPage()
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CAI"].ConnectionString);
        conn.Open();
        string sql = "Select Heading, Text, OrderCOl From DONATION_PAGE Where Active=1 Order By OrderCol";
        SqlCommand cmd = new SqlCommand(sql, conn);
        SqlDataReader dr = cmd.ExecuteReader(); int i = 0;
        while (dr.Read())
        {
            //-----create new article control---------
            //Load control from template and assign unique ID
            Control art = LoadControl("~/design/Article.ascx");
            art.ID = dr["Heading"].ToString() + i.ToString(); i++;

            //get header and content placeholders for newly created article control
            PlaceHolder header = (PlaceHolder)art.FindControl("HeaderPlaceholder");
            PlaceHolder content = (PlaceHolder)art.FindControl("ContentPlaceholder");

            //assign header to a literal control
            Literal litHeader = new Literal(); litHeader.Text = dr["Heading"].ToString();

           //assign text to a literal control
            Literal litText = new Literal(); litText.Text = dr["Text"].ToString();

            //add literals to placeholders and add article to PagePanel
            if (header != null && content != null) { header.Controls.Add(litHeader); content.Controls.Add(litText); }
            PagePanel.Controls.Add(art);
        }
        dr.Close(); Global_Functions.CloseConnection(conn);
    }
开发者ID:CAI-IT,项目名称:Website,代码行数:30,代码来源:Donations.aspx.cs


示例17: FulltextFunction

		protected FulltextFunction(ReservedKeyword keyword, Expression query, Literal language) {
			Debug.Assert(keyword != null);
			Debug.Assert(query != null);
			this.keyword = keyword;
			this.query = query;
			this.language = language;
		}
开发者ID:avonwyss,项目名称:bsn-modulestore,代码行数:7,代码来源:FulltextFunction.cs


示例18: Literal

 void IView.Error(string message)
 {
     Literal lit = new Literal();
     lit.Text = message;
     phWidgetLists.Controls.Clear();
     phWidgetLists.Controls.Add(lit);
 }
开发者ID:jaytem,项目名称:minGit,代码行数:7,代码来源:personalization_widget_list_container.ascx.cs


示例19: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        String _storId = Request.QueryString["storId"];

        if (!String.IsNullOrEmpty(_storId))
        {
            Stories _st = new Stories(ConfigurationManager.ConnectionStrings["TopRockConnection"].ConnectionString);
            _st.LitePopulate(_storId);

            if (!String.IsNullOrEmpty(CommonUtility.NullSafeString(_st.YouTubeLink, "").Trim()))
            {
                Literal _li = new Literal();
                _li.Text = _st.YouTubeLink;
                secureHolder.Controls.Add(_li);
            }
            else
            {
                if (!String.IsNullOrEmpty(CommonUtility.NullSafeString(_st.ImgType, "").Trim()))
                {
                    Image _img = new Image();
                    _img.ImageUrl = String.Format(ConfigurationManager.AppSettings["StoriesImagesPath"], _st.ID.ToString(), _st.ImgType);
                    secureHolder.Controls.Add(_img);
                }
            }

        }
    }
开发者ID:noximus,项目名称:TopOfTheRock,代码行数:27,代码来源:ViewStoryFile.aspx.cs


示例20: LoadComments

    public void LoadComments(int AccID)
    {
        LoanAccountDSTableAdapters.AccountCommentTableAdapter accComment = new LoanAccountDSTableAdapters.AccountCommentTableAdapter();
        LoanAccountDS.AccountCommentDataTable tblAccComment = accComment.GetAccountComment(AccID);

        foreach (LoanAccountDS.AccountCommentRow r in tblAccComment)
        {
            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><i><b> " + r.datUser.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);
        }
    }
开发者ID:infosystemproject2014,项目名称:microfinance,代码行数:25,代码来源:ctDefault.ascx.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# LiteralControl类代码示例发布时间:2022-05-24
下一篇:
C# ListenerForUnitTests类代码示例发布时间: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