HtmlLink.Href Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém ou define o destino URL do link especificado no HtmlLink controlo.
public:
virtual property System::String ^ Href { System::String ^ get(); void set(System::String ^ value); };
public virtual string Href { get; set; }
member this.Href : string with get, set
Public Overridable Property Href As String
Valor de Propriedade
O destino da URL do link.
Exemplos
O exemplo de código seguinte demonstra como definir a Href propriedade para uma folha de estilos em cascata (CSS) que é guardada no mesmo diretório da página Web. Para um exemplo completo e funcional de código, veja o HtmlLink tópico de visão geral da aula.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class HtmlLinkcs_aspx
{
void Page_Init(object sender, EventArgs e)
{
// Create an instance of HtmlLink.
HtmlLink myHtmlLink = new HtmlLink();
myHtmlLink.Href = "StyleSheet.css";
myHtmlLink.Attributes.Add("rel", "stylesheet");
myHtmlLink.Attributes.Add("type", "text/css");
// Add the instance of HtmlLink to the <HEAD> section of the page.
head1.Controls.Add(myHtmlLink);
}
}
// Define an HtmlLink control.
HtmlLink myHtmlLink = new HtmlLink();
myHtmlLink.Href = "~/StyleSheet.css";
myHtmlLink.Attributes.Add("rel", "stylesheet");
myHtmlLink.Attributes.Add("type", "text/css");
' Define an HtmlLink control.
Dim myHtmlLink As New HtmlLink()
myHtmlLink.Href = "~/StyleSheet.css"
myHtmlLink.Attributes.Add("rel", "stylesheet")
myHtmlLink.Attributes.Add("type", "text/css")
Partial Class HtmlLinkvb_aspx
Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
' Create an instance of HtmlLink.
Dim myHtmlLink As HtmlLink = New HtmlLink()
myHtmlLink.Href = "StyleSheet.css"
myHtmlLink.Attributes.Add("rel", "stylesheet")
myHtmlLink.Attributes.Add("type", "text/css")
' Add the instance of HtmlLink to the <HEAD> section of the page.
head1.Controls.Add(myHtmlLink)
End Sub
End Class
Observações
A Href propriedade especifica o destino URL do link especificado no HtmlLink controlo. Pode usar esta propriedade para especificar a localização de uma folha de estilo em cascata externa (CSS).