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.

异常

NamingContainercontrol 属性为 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.

适用于