WebControl.CopyBaseAttributes(WebControl) 方法

定義

將不被 Style 物件封裝的屬性從指定的 Web 伺服器控制項複製到呼叫這個方法的 Web 伺服器控制項上。Copies the properties not encapsulated by the Style object from the specified Web server control to the Web server control that this method is called from. 這個方法主要由控制項開發人員使用。This method is used primarily by control developers.

public:
 void CopyBaseAttributes(System::Web::UI::WebControls::WebControl ^ controlSrc);
public void CopyBaseAttributes (System.Web.UI.WebControls.WebControl controlSrc);
member this.CopyBaseAttributes : System.Web.UI.WebControls.WebControl -> unit
Public Sub CopyBaseAttributes (controlSrc As WebControl)

參數

controlSrc
WebControl

WebControl,表示其屬性被複製到呼叫這個方法的 Web 伺服器控制項上的來源控制項。A WebControl that represents the source control with properties to be copied to the Web server control that this method is called from.

例外狀況

controlSrcnullcontrolSrc is null.

備註

CopyBaseAttributes方法 AccessKey 會將、、 Enabled ToolTipTabIndexAttributes 屬性從指定的 web 伺服器控制項複製到這個方法被呼叫的 web 伺服器控制項。The CopyBaseAttributes method copies the AccessKey, Enabled, ToolTip, TabIndex, and Attributes properties from the specified Web server control to the Web server control that this method is called from. 這通常用於 Web 服務器控制項在轉譯和使用控制項時,以動態方式建立新控制項的情況。This is commonly used in cases where a Web server control works by dynamically creating new controls while it is rendering and using the controls. 這個方法在這種情況下很有用,因為它會複製所有未由物件封裝之 Web 服務器控制項的屬性 Style ,因此可以放在所轉譯標記的最外層控制項上。This method is useful in this situation because it copies all properties of Web server controls not encapsulated by the Style object so they can be placed on the outermost control of a tag that is being rendered.

適用於

另請參閱