Control.GetUniqueIDRelativeTo(Control) 方法

定義

傳回指定之控制項 UniqueID 屬性的前置部分。Returns the prefixed portion of the UniqueID property of the specified control.

public:
 System::String ^ GetUniqueIDRelativeTo(System::Web::UI::Control ^ control);
public string GetUniqueIDRelativeTo (System.Web.UI.Control control);
member this.GetUniqueIDRelativeTo : System.Web.UI.Control -> string

參數

control
Control

位在命名容器內的控制項。A control that is within a naming container.

傳回

指定之控制項 UniqueID 屬性的前置部分。The prefixed portion of the UniqueID property of the specified control.

例外狀況

controlNamingContainer 屬性為 nullThe NamingContainer property of control is null.

controlnullcontrol is null.

備註

控制項的 UniqueID 屬性是藉由將前置詞新增至控制項的 ID 屬性而產生的。The UniqueID property of a control is generated by adding a prefix to the control's ID property. 前置詞是由與分隔符號串連的控制項命名容器的 UniqueID 屬性所組成。The prefix is composed of the UniqueID property of the control's naming container concatenated with a separator character. 如果命名容器是頁面,則不會有前置詞。If the naming container is the page, there is no prefix. 這個方法會傳回前置詞字串。This method returns the prefix string. 如果沒有前置詞字串,它會傳回控制項的 UniqueID 值。If there is no prefix string, it returns the UniqueID value of the control.

適用於