2007年8月9日 星期四

The difference between User Control and Server Control

User Control與 Server Control 都是可重複使用的程式碼,但是 User Control 定義完之後,往往只是適用於目前所開發的專案,當有另一個專案要開發時,我們只能重新修改 User Control 或是做 Copy-Past 的工作。然而 Server Control 定義完之後,我們每一個專案在開發時,都能夠直接使用,不需額外修改。

在效能方面,early bound Server Control 比 late bound ASP/COM(+)/VBScript Object 速度快三倍,但是 Server Control 會額外花費一些時間在 UI 介面的呈現與 PostBack 訊息處理上。所以,當你發現 Server Control 的效能低落時,就必須要檢查 Rendering 與 PostBack 這兩個地方有沒有寫好。

沒有留言:

張貼留言