UserControl.IsPostBack 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 kontrol pengguna sedang dimuat sebagai respons terhadap postback klien, atau jika dimuat dan diakses untuk pertama kalinya.
public:
property bool IsPostBack { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool IsPostBack { get; }
[<System.ComponentModel.Browsable(false)>]
member this.IsPostBack : bool
Public ReadOnly Property IsPostBack As Boolean
Nilai Properti
true jika kontrol pengguna sedang dimuat sebagai respons terhadap postback klien; jika tidak, false.
- Atribut
Contoh
Contoh berikut menambahkan dua pasangan nilai kunci ke status aplikasi yang terkait dengan kontrol pengguna jika properti kontrol IsPostBack pengguna mengembalikan false. Ketika kondisi ini terpenuhi, kode menggunakan Add metode , melalui properti kontrol Application pengguna, untuk menambahkan kunci dan nilainya.
if (!myControl.IsPostBack)
{
// Add new objects to the HttpApplicationState.
// These will be maintained as long as the application is active.
myControl.Application.Add("Author","Shafeeque");
myControl.Application.Add("Date",new DateTime(2001,6,21));
// Add an object to the cache with expirations
// set to 0.1 minute.
myControl.Cache.Insert("MyData1", "somevalue", null, DateTime.Now.AddMinutes(0.1), Cache.NoSlidingExpiration);
}
If (Not myControl.IsPostBack) Then
' Add new objects to the HttpApplicationState.
' These will be maintained as long as the as the application is active.
myControl.Application.Add("Author","Shafeeque")
myControl.Application.Add("Date",new DateTime(2001,6,21))
' Add an object to the cache with expirations
' set to 0.1 minute.
myControl.Cache.Insert("MyData1", "somevalue", Nothing, DateTime.Now.AddMinutes(0.1), Cache.NoSlidingExpiration)