What is LiteralControl? Why is it used?

前端 未结 7 2381
暖寄归人
暖寄归人 2020-12-15 06:11

What is a LiteralControl? I was reading about LiteralContols but I am not sure why they are used. I used this code to list the controls in a page and - I have

7条回答
  •  不思量自难忘°
    2020-12-15 06:28

    Try this:

    foreach (Control control in Page.Controls)
    {
        Response.Write(control.GetType().ToString() + " -  " + control.ID + "
    "); if (control is LiteralControl) { Response.Write("Textt :" + ((LiteralControl)control).Text.ToString() + " - " + Server.HtmlEncode(((LiteralControl)control).Text + "
    ") ); } }

提交回复
热议问题