Version

Set Visible Resources

You can control the number of resources displayed by the WebSchedule™ controls when multiple resource view is enabled. To do this, handle the ResourcesFetched event and remove the resources you do not want to show using the WebScheduleInfo™ component’s VisibleResources property.

You can also pre-populate the VisibleResources collection by creating Resource objects and adding them to the collection, preferably in the page’s PreLoad event.

The following code shows you how to handle the ResourcesFetched event to display the visible resources.

In HTML:

<igsch:webscheduleinfo runat="server" ID="WebScheduleInfo1" EnableSmartCallbacks="
            EnableMultiResourceView="true"
            onresourcesfetched="WebScheduleInfo1_ResourcesFetched">
</igsch:webscheduleinfo>

In Visual Basic:

Protected Sub WebScheduleInfo1_ResourcesFetched(ByVal sender As Object, ByVal e As EventArgs)
    ' Set active resource
    Me.WebScheduleInfo1.ActiveResourceName = "Jen"
    ' Find resource John
    Dim john As Resource = Me.WebScheduleInfo1.VisibleResources.GetResourceFromName("John")
    ' Remove John from visible resources
    If john IsNot Nothing Then
        Me.WebScheduleInfo1.VisibleResources.Remove(john)
    End If
End Sub

In C#:

protected void WebScheduleInfo1_ResourcesFetched(object sender, EventArgs e)
{
   // Set active resource
   this.WebScheduleInfo1.ActiveResourceName = "Jen";
   // Find resource John
   Resource john = this.WebScheduleInfo1.VisibleResources.GetResourceFromName("John");
   // Remove John from visible resources
   if (john != null)
      this.WebScheduleInfo1.VisibleResources.Remove(john);
 }