ASP.NET : Literal
Top 23 ASP.NET Example Pages...

[[".XY7.BCBXCCCSTUUUUTTUUUUXSTTUUUUTTUUUU","tsrhw.","LiteralControl."," The ASP.NET LiteralControl renders text data. It is a way to embed a comment or text in the HTML source of each ASP.NET page rendered. Here we see an example of this web control and add a timestamp to our pages, using the C# language.","Example."," First, here is how to get the current time in the best format, which keeps the comments small, and also how to use LiteralControl to add a comment to your pages. We create a new LiteralControl and append it to the bottom of the .aspx page. ","Code that uses LiteralControl: C#","\n\nstatic public string TimeString()\n{\n return DateTime.Now.ToString(\"h:mm:ss\");\n}\n\nprotected void Page_Load(object sender, EventArgs e)\n{\n ","LiteralControl"," literal = new LiteralControl(\"<!-- \" +\n TimeString() + \" -->\");\n Page.Controls.Add(literal);\n}","The DateTime.Now property"," is used to get the current time. On it, we call ToString with a formatting parameter string. The string indicates that we want the date with the \"short\" hour (1-12, not 0-23), and the minutes and seconds. ","DateTime Format ","datetime-format","Tip: ","This method is static. It uses no instance members on the class. More information on static methods is available.","Static Method ","static","The Page_Load event"," runs each time the page is run. This is important for adding the LiteralControl at the bottom of each page. LiteralControl is simply a text string object that we can place quickly in the page. ","Note: ","Look at how we use the constructor. We specify that we want an HTML comment. The TimeString() method is called.","And: ","This returns the \"2:26:42\" style time string. We put it in the HTML comment.","Finally: ","In the above code, we append the LiteralControl to the document. This is an object-oriented way to add the comment.","ins","class","adsbygoogle","data-ad-client","ca-pub-4712093147740724","data-ad-slot","6227126509","data-ad-format","auto","br","ins","class","adsbygoogle","data-ad-client","ca-pub-4712093147740724","data-ad-slot","6227126509","data-ad-format","auto","Summary."," We looked at the LiteralControl class. This is an object-oriented way of effectively adding timestamps to pages. You may also need to add timestamps to ASP.NET web controls, your HtmlTextWriter code, and other places. ","br","ins","class","adsbygoogle","data-ad-client","ca-pub-4712093147740724","data-ad-slot","3679700504","data-ad-format","link","br","ins","class","adsbygoogle","data-ad-client","ca-pub-4712093147740724","data-ad-slot","6227126509","data-ad-format","auto"],"url(data:image/png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