共用方式為


ReferencePath 屬性

設定或傳回使用者控制項 (.ascx 檔) 參考。預設值是 null

public string ReferencePath {
   get,
   set
}

備註

網頁上的樣式表繼承的樣式,是定義於所參考的使用者控制項根層級的樣式表中。例如,如果使用者控制項上的樣式表有 Style1 屬性,網頁就能像存取網頁上的樣式表般地存取 Style1。

範例

下列範例示範如何使用 ReferencePath 屬性指定含樣式表的使用者控制項。

// Code  in an .aspx file.
<Mobile:StyleSheet id="Style1" ReferencePath="Mobile_style.ascx"
    runat="server" />
<mobile:Form id=WelcomeForm runat="server" stylereference="Style1"    
    title="Welcome" >
   <mobile:label runat=server Text=" Welcome " stylereference="title" />
</mobile:Form>

// Mobile_style.ascx ( external stylesheet ).

<Mobile:Stylesheet runat=server>
    <Style name="Style1">
        <DeviceSpecific>
          <Choice Filter="isHTML32">
            <HeaderTemplate>
                //Add Code and controls
            </HeaderTemplate>
            <FooterTemplate>
                //Add Code and controls
            </FooterTemplate>
           </Choice>
        </DeviceSpecific>
    </Style>
</Mobile:Stylesheet>  

請參閱

套用至:StyleSheet 類別