HttpCapabilitiesBase.SupportsSelectMultiple Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan nilai yang menunjukkan apakah browser mendukung multiple
atribut elemen HTML <select>
.
public:
virtual property bool SupportsSelectMultiple { bool get(); };
public virtual bool SupportsSelectMultiple { get; }
member this.SupportsSelectMultiple : bool
Public Overridable ReadOnly Property SupportsSelectMultiple As Boolean
Nilai Properti
true
jika browser mendukung multiple
atribut elemen HTML <select>
; jika tidak, false
. Defaultnya adalah true
.
Contoh
Contoh kode berikut menunjukkan cara menentukan apakah browser mendukung multiple
atribut elemen HTML <select>
.
<%@ page language="C#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Load(Object Sender, EventArgs e)
{
CheckBrowserCaps();
}
void CheckBrowserCaps()
{
String labelText = "";
System.Web.HttpBrowserCapabilities myBrowserCaps = Request.Browser;
if (((System.Web.Configuration.HttpCapabilitiesBase)myBrowserCaps).SupportsSelectMultiple)
{
labelText = "Browser supports the MULTIPLE attribute of HTML SELECT elements.";
}
else
{
labelText = "Browser does not support the MULTIPLE attribute of HTML SELECT elements.";
}
Label1.Text = labelText;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Browser Capabilities Sample</title>
</head>
<body>
<form runat="server" id="form1">
<div>
Browser Capabilities:
<p/><asp:Label ID="Label1" Runat="server" />
</div>
</form>
</body>
</html>
<%@ page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
CheckBrowserCaps()
End Sub
Function CheckBrowserCaps()
Dim labelText As String = ""
Dim myBrowserCaps As System.Web.HttpBrowserCapabilities = Request.Browser
If (CType(myBrowserCaps, System.Web.Configuration.HttpCapabilitiesBase)).SupportsSelectMultiple Then
labelText = "Browser supports the MULTIPLE attribute of HTML SELECT elements."
Else
labelText = "Browser does not support the MULTIPLE attribute of HTML SELECT elements."
End If
Label1.Text = labelText
End Function 'CheckBrowserCaps
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Browser Capabilities Sample</title>
</head>
<body>
<form runat="server" id="form1">
<div>
Browser Capabilities:
<p/><asp:Label ID="Label1" Runat="server" />
</div>
</form>
</body>
</html>
Berlaku untuk
Berkolaborasi dengan kami di GitHub
Sumber untuk konten ini dapat ditemukan di GitHub, yang juga dapat Anda gunakan untuk membuat dan meninjau masalah dan menarik permintaan. Untuk informasi selengkapnya, lihat panduan kontributor kami.