UserControl.IsPostBack Eigenschap

Definitie

Hiermee wordt een waarde opgehaald die aangeeft of het gebruikersbesturingselement wordt geladen als reactie op een postback van een client of dat het voor het eerst wordt geladen en geopend.

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

Waarde van eigenschap

true als het gebruikersbesturingselement wordt geladen als reactie op een postback van een client; anders, false.

Kenmerken

Voorbeelden

In het volgende voorbeeld worden twee sleutelwaardeparen toegevoegd aan de toepassingsstatus die is gekoppeld aan een gebruikersbesturingselement als de eigenschap van IsPostBack het gebruikersbesturingselement wordt geretourneerd false. Wanneer aan deze voorwaarde wordt voldaan, gebruikt de code de Add methode, via de eigenschap van Application het gebruikersbesturingselement, om de sleutels en de bijbehorende waarden toe te voegen.

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)        

Van toepassing op

Zie ook