All navigation controls in this Demo are LinkSelectors.
If a non-licensed version of the WebGadgets assembly is used, the WebControl will ocassionally issue red Powered by Axezz WebGadgets links inside the LinkSelectors.
Copyright © axezz 2005 www.axezz.com

Interacting with the LinkSelector

• Using the LinkSelector for URL navigation

Set the LinkItem.NavigateUrl for each LinkItem in the LinkSelector.LinkItems collection.

  <awg:LinkSelector id="LinkSelector1" runat="server" 
    LinkSelectorType="ThemedTabStrip" Width="300px">
    <LinkItems>
      <awg:LinkItem Id="TV">
        <LinkItems>
          <awg:LinkItem Id="Channel1" Text="Channel 1" NavigateUrl="http://www.channel1.com/" ></awg:LinkItem>
          <awg:LinkItem Id="Channel2" Text="Channel 2" NavigateUrl="http://www.channel2.com/"></awg:LinkItem>
        </LinkItems>
      </awg:LinkItem>
      <awg:LinkItem Id="Radio">
        <LinkItems>
          <awg:LinkItem Id="R1" Text="Radio One" NavigateUrl="http://www.radio1.com/" ></awg:LinkItem>
          <awg:LinkItem Id="R2" Text="Radio Two" NavigateUrl="http://www.radio1.com/" ></awg:LinkItem>
        </LinkItems>
      </awg:LinkItem>   
    </LinkItems>
  </awg:LinkSelector>

When using the LinkSelector for site navigation, the properties SelectedItem and SelectedChildItem must be set on each page. To automate this process, the LinkSelector can be placed inside a UserControl (an ascx file). The two properties SelectedItem and SelectedChildItem can then be exposed as properties on the UserControl and be set on each page manually. Alternatively, some logic can be added in the UserControl's code behind so it will detect what page it resides in and then set the selected items automatically. See the Site Navigation Demo for more details.

• Setting initial Selected Item

Set LinkSelector.SelectedItem, LinkSelector.SelectedChildItem or LinkSelector.SelectedItemIndex.

<awg:LinkSelector id="LinkSelector1" runat="server"
  PreMadeList="DefaultList" SelectedItem="All" LinkSelectorType="ThemedLinkList">
</awg:LinkSelector>			

• Responding to click events

On a general page Postback, the SelectedItem, SelectedChildItem and SelectedItemIndex properties are available in the LinkSelector.Load event.

If the page postback is initiated from the LinkSelector, the selected item must be checked in the LinkSelector.Click event.

private void SetSelectedPanel()
{
  LinkSelectorPanel1.Visible = false;
  LinkSelectorPanel2.Visible = false;
  LinkSelectorPanel3.Visible = false;
  switch (LinkSelectorMenu.SelectedItemIndex)
  {
    case 0:
      LinkSelectorPanel1.Visible = true;
      switch (LinkSelectorMenu.SelectedChildItem)
      {
        case "item1":
          PlaceHolder1.Visible = true;
          PlaceHolder2.Visible = false;
          break;
        case "item2":
          PlaceHolder1.Visible = false;
          PlaceHolder2.Visible = true;
          break;
      }
      break;
    case 1:
      LinkSelectorPanel2.Visible = true;
      break;
    case 2:
      LinkSelectorPanel3.Visible = true;
      break;
  }
}

private void LinkSelectorMenu_Load(object sender, System.EventArgs e)
{
  SetSelectedPanel();
}

private void LinkSelectorMenu_Click(object sender, System.EventArgs e)
{
  SetSelectedPanel();
}

See the LinkSelectorPanel Demo for a fully working example.