ListControl.AutoPostBack Özellik

Tanım

Kullanıcı liste seçimini değiştirdiğinde sunucuya geri göndermenin otomatik olarak gerçekleşip gerçekleşmediğini belirten bir değer alır veya ayarlar.

public:
 virtual property bool AutoPostBack { bool get(); void set(bool value); };
public virtual bool AutoPostBack { get; set; }
[System.Web.UI.Themeable(false)]
public virtual bool AutoPostBack { get; set; }
member this.AutoPostBack : bool with get, set
[<System.Web.UI.Themeable(false)>]
member this.AutoPostBack : bool with get, set
Public Overridable Property AutoPostBack As Boolean

Özellik Değeri

Boolean

true kullanıcı listenin seçimini her değiştirse sunucuya geri gönderme otomatik olarak gerçekleşirse; aksi takdirde , false. Varsayılan değer: false.

Öznitelikler

Örnekler

Aşağıdaki örnekte denetim için etkinleştirme AutoPostBack gösterilmektedir ListBox .

<%@ Page Language="C#" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ListBox AutoPostBack Example</title>
<script runat="server">

      void Page_Load(Object sender, EventArgs e)
      {
         if (ListBox1.SelectedItem != null)
            Label1.Text = "You selected: " + ListBox1.SelectedItem.Value;
         else
            Label1.Text = "";
      }

   </script>

</head>

<body>

   <form id="form1" runat="server">

      <h3>ListBox AutoPostBack Example</h3>

      Select an item from the list box: <br /><br />

      <asp:ListBox id="ListBox1" 
           Rows="4"
           AutoPostBack="True" 
           SelectionMode="Single"  
           runat="server">
 
         <asp:ListItem>Item 1</asp:ListItem>
         <asp:ListItem>Item 2</asp:ListItem>
         <asp:ListItem>Item 3</asp:ListItem>
         <asp:ListItem>Item 4</asp:ListItem>
         <asp:ListItem>Item 5</asp:ListItem>
         <asp:ListItem>Item 6</asp:ListItem>
  
      </asp:ListBox>

      <br /><br />

      <asp:Label id="Label1"
           runat="server"/>

   </form>

</body>
</html>

<%@ Page Language="VB" AutoEventWireup="True" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ListBox AutoPostBack Example</title>
<script runat="server">

      Sub Page_Load(sender As Object, e As EventArgs)
      
         If Not IsNothing(ListBox1.SelectedItem)
            Label1.Text = "You selected: " & ListBox1.SelectedItem.Value
         Else
            Label1.Text = ""
         End If

      End Sub

   </script>

</head>

<body>

   <form id="form1" runat="server">

      <h3>ListBox AutoPostBack Example</h3>

      Select an item from the list box: <br /><br />

      <asp:ListBox id="ListBox1" 
           Rows="4"
           AutoPostBack="True" 
           SelectionMode="Single"  
           runat="server">
 
         <asp:ListItem>Item 1</asp:ListItem>
         <asp:ListItem>Item 2</asp:ListItem>
         <asp:ListItem>Item 3</asp:ListItem>
         <asp:ListItem>Item 4</asp:ListItem>
         <asp:ListItem>Item 5</asp:ListItem>
         <asp:ListItem>Item 6</asp:ListItem>
  
      </asp:ListBox>

      <br /><br />

      <asp:Label id="Label1"
           runat="server"/>

   </form>

</body>
</html>

Açıklamalar

Sunucunun seçimi yapılır yapılmaz yakalaması gerekiyorsa bu özelliği true olarak ayarlayın. Örneğin, Web sayfasındaki diğer denetimler, kullanıcının liste denetiminden seçimine bağlı olarak otomatik olarak doldurulabilir.

Bu özellik, bir kullanıcının listeden seçimine göre Web sayfasındaki diğer denetimlerin otomatik olarak nüfusa izin vermek için kullanılabilir.

Bu özelliğin değeri görünüm durumunda depolanır.

Bu özellik temalar veya stil sayfası temaları tarafından ayarlanamaz. Daha fazla bilgi için bkzThemeableAttribute. temalar ve dış görünümler ASP.NET.

Şunlara uygulanır