Search code examples
asp.netvb.netmultiview

Update databound value on a label when MultiView Active View Changed?


I have a MultiView with several Views within it. When the ActiveView changes I want to selectively databind a label that is in one of the views. Ideally, I don't want to do it every time the ActiveView changes, rather only when it is actually the view containing the label that is active. I tried something like this:

Private Sub MultiView1_ActiveViewChanged(sender as Object, e as System.EventArgs) Handles MultiView1.ActiveViewChanged
   Dim varView as String = MultiView1.GetActiveView.ToString
   If varView = "vwExisting" Then
      ' Code to update label here with latest databind.
   End If
End Sub

Now, MultiView1.GetActiveView.ToString doesn't return the value I'm looking for, does anyone know what will?


Solution

  • The GetActiveView Method returns a View Class, not a string. Try this...

    If MultiView1.GetActiveView.ID = "vwExisting" Then
    
    End If