本文整理汇总了C#中System.Web.UI.WebControls.Literal.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Literal.ToString方法的具体用法?C# Literal.ToString怎么用?C# Literal.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Literal
的用法示例。
在下文中一共展示了Literal.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnShow_Click
protected void btnShow_Click(object sender, EventArgs e)
{
//I need to dynamically create the instance with code, for instance table[i] needs to be systematically created
//int i = 0;
System.Web.UI.HtmlControls.HtmlTable Htable = new HtmlTable();
System.Web.UI.HtmlControls.HtmlTableRow Hrow = new HtmlTableRow();
System.Web.UI.HtmlControls.HtmlTableCell cell01 = new HtmlTableCell(); //I want to try to concatenate
//use a literal to build the statement, then assign a differents literal the text alue of the statement string.
System.Web.UI.HtmlControls.HtmlTableCell cell02 = new HtmlTableCell();
System.Web.UI.HtmlControls.HtmlTableCell cell03 = new HtmlTableCell();
Label Label1 = new Label();
Label1.Text = "1";
Label Label2 = new Label();
Label2.Text = "Tom Jenkins";
Label Label3 = new Label();
Label3.Text = "[email protected]";
Literal lit1 = new Literal();
Literal lit2 = new Literal();
Literal lit3 = new Literal();
lit1.Text = "Literal 1";
lit2.Text = "Literal 2";
lit3.Text = "Literal 3";
Htable.Border = 1;
cell01.InnerHtml = "ID";
cell02.InnerHtml = "Name";
cell03.InnerHtml = "email";
Hrow.Cells.Add(cell01);
Hrow.Cells.Add(cell02);
Hrow.Cells.Add(cell03);
Htable.Rows.Add(Hrow);
cell01 = new HtmlTableCell();
cell02 = new HtmlTableCell();
cell03 = new HtmlTableCell();
cell01.InnerHtml = lit1.ToString();
cell02.InnerHtml = lit2.ToString();
cell03.InnerHtml = lit3.ToString();
Hrow = new HtmlTableRow();
Hrow.Cells.Add(cell01);
Hrow.Cells.Add(cell02);
Hrow.Cells.Add(cell03);
Htable.Rows.Add(Hrow);
this.Controls.Add(Htable);
//do while (i < 3)
// {
// i++;
// }
//string[] arr = new string[4]; // Initialize
//arr[0] = "one"; // Element 1
//arr[1] = "two"; // Element 2
//arr[2] = "three"; // Element 3
//arr[3] = "four"; // Element 4
//// Loop over strings
//foreach (string s in arr)
//{
// Console.WriteLine(s);
//}
//// Array a1 = new Array[1, 2, 3, 4];
// string[] a1 = new string[2];
// a1[0] = "First Element";
// a1[1] = "Second Element";
// a1[2] = "Third Element";
// foreach (string s in a1)
// {
// Label lba = new Label();
// lba.Text = a1[i].ToString();
// Console.WriteLine(s);
// }
// for i = o while i is less than row count plus or minus 1, loop through and array and do something to practice looping data with arrays, collections, and tables.
//A tables, b for each loops with different types of data, and C using an array to work on this and add data. Use these controls in an array.
//DynamicControlsPlaceholder (DCP)
//look into web controls, what they cand be used for, and how they differ from HTML table contr
}