At the beginning, friends of. NET may not know the differences between literal and label. In fact, they only have one difference, that is, they are converting to the client html Code Label becomes <span> </span>, and literal does not contain any labels:
To manage video news on a website yesterday, first add a player to the page, as shown below: 1 < Object Height = 288 Width = 384 Classid = CLSID: cfcdaa03-8be4-11cf-b84b-0020afbbccfa Viewastext >
2 < Param Name = "_ Extentx" Value = "10160" > < Param Name = "_ Extenty" Value = "7620" >
3 < Param Name = "Autostart" Value = "-1" > < Param Name = "Shuffle" Value = "0" >
4 < Param Name = "Prefetch" Value = "0" > < Param Name = "Nolabels" Value = "0" >
5 < Param Name = "Src" Value = "<Asp: literal id = 'lt _ src' runat = 'server'> </ASP: literal>" >
6 < Param Name = "Controls" Value = "Imagewindow" > < Param Name = "Console" Value = "Clip1" >
7 < Param Name = "Loop" Value = "0" > < Param Name = "Numloop" Value = "0" > < Param Name = "Center" Value = "0" >
8 < Param Name = "Maintainaspect" Value = "0" > < Param Name = "Backgroundcolor" Value = "#000000" >
9 </ Object >
So how can the player play different content based on the parameters we pass? The first line of the preceding HTML code specifies the source of the content played by the player. In order to play different content based on different parameters, we set the value to a literal control, then, in the Post code, it is OK to dynamically assign values to the text attribute of literal. The Code is as follows: /**/ /// <Summary>
///Author: shy520
///Http://pw.cnblogs.com
/// </Summary>
Public Class Showvideocontent: system. Web. UI. usercontrol
{
Protected System. Web. UI. webcontrols. Literal lt_reader;
Protected System. Web. UI. webcontrols. Literal lt_vdate;
Protected System. Web. UI. webcontrols. Literal lb_author;
Protected System. Web. UI. webcontrols. Literal lt_resource;
Protected System. Web. UI. webcontrols. Label lb_title;
// Note: The literal written in the object needs to be manually defined.
Literal lt_src;
Private Void Page_load ( Object Sender, system. eventargs E)
{
If (Request. querystring [ " ID " ] ! = Null )
{
Int ID = Int . Parse (request. querystring [ " ID " ]. Tostring ());
// Get video news content
Videocontent VC = Videocontent. Find (ID );
Lt_reader.text = VC. ANNOUNCER;
Lt_vdate.text = VC. vdate. to1_datestring ();
Lb_author.text = VC. Author;
Lt_resource.text = VC. resource;
Lb_title.text = VC. videotitle;
// Assign a value to the playback content
Lt_src.text = VC. linkurl;
}
}
}
The literal usage is very flexible. I hope the above can help you!