title: ASP.NET: How to update frontend within a subscribed event handler
body: <p><strong>The situation</strong></p>
  
  <p>I have an ASP.NET Webform that contains some status information about a users Microsoft Lync 2010 session. In the Page_Load event i registered an event handler that listenes for a Lync session status change event. </p>
  
  <p>Once the event fires, the event handler reacts correctly and does its job: it changes the according text of a specific label. The problem is, the changes are not visible in the front end webpage.</p>
  
  <p><strong>The code</strong></p>
  
  <p>This is a global Lync Client instance, defined in the page.</p>
  
  <pre><code>private LyncClient _lyncClient;
  </code></pre>
  
  <p>Here I am registering the LyncClient in the Page_Load event.</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      RegisterLyncClient();
  }
  </code></pre>
  
  <p>I assign the LyncClient instance to the global _lyncClient. After that I register my event listener.</p>
  
  <pre><code>private void RegisterLyncClient()
  {
      _lyncClient = LyncClient.GetClient();
      _lyncClient.StateChanged += HandleStateChanged;
  }
  </code></pre>
  
  <p>This function is fired correctly as the Lync Client changes its state. Its visible during Debug mode.</p>
  
  <pre><code>private void HandleStateChanged(object sender, ClientStateChangedEventArgs e)
  {
       SetLyncStatus(e.NewState);
  }
  </code></pre>
  
  <p>The labels text is changed correctly (during debug mode). But the changes are not visible in frontend.</p>
  
  <pre><code>private void SetLyncStatus(ClientState lyncState)
  {
      lblLyncStatus.Text = lyncState.ToString();
  }
  </code></pre>
  
  <p><strong>Assumption</strong></p>
  
  <p>If I use a button to manually change the status or if I use a timer to check and adjust the status every second, the changes are visible. So I assume the changes made within the HandleStateChanged event handler are not visible, because there is no postback after calling the SetLyncStatus function.</p>
  
  <p><strong>Question</strong></p>
  
  <p>Is it possible to force a postback from an event handler, that is not fired from a users action (e.g. user clicks a button)? It would be perfect, if its possible to call a partial refresh of the label or a defined section.</p>
  
  <p>Any suggestions much appreciated. Thanks!</p>