Literal跟PlaceHolder都是可以用來動態載入網頁內容用的控制項
差別在Literal是直接寫入html內容
PlaceHolder是加入另一個Controls

假設在網頁上有Literal與PlaceHolder
以下的程式碼就可以看出功能上的差異

    protected void Button1_Click(object sender, EventArgs e)
    {
        Label lable = new Label();
   
        lable.Text = "This new Label1.";
        label.Bold = true;

        this.PlaceHolder1.Controls.Add(label);
        this.Literal1.Text = "<b>This new Label2.</b>";
       
    }

转自:http://www.purecs.net/thread/topic389_1.aspx

我想其實Literal跟PlaceHolder是可以只寫成一個控制項並提供兩者的功能才對
不過微軟並沒有這麼做

相关文章:

  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-12-17
  • 2021-07-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
  • 2021-11-18
  • 2022-12-23
  • 2021-07-20
  • 2021-07-21
相关资源
相似解决方案