using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Telerik.WebControls;

namespace BrowserBar
{
    public partial class _Default : System.Web.UI.Page
    {

        protected void selectionChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            pageFrame.Attributes["src"] = e.Text;
        }

        protected void RadToolbar1_OnClick(object sender, Telerik.WebControls.RadToolbarClickEventArgs e)
        {
            RadComboBox RadComboBox1 = (RadComboBox)Radtoolbartemplatebutton1.FindControl("RadComboBox1");
            RadComboBoxItem currentItem = null;
            switch (e.Button.CommandName)
            {
                case "Forward":
                    {
                        if (RadComboBox1.SelectedIndex < RadComboBox1.Items.Count - 1)
                        {
                            RadComboBox1.SelectedIndex += 1;
                            currentItem = RadComboBox1.Items[RadComboBox1.SelectedIndex];
                            RadComboBox1.Text = currentItem.Text;
                        }

                        break;
                    }
                case "Back":
                    {
                        if (RadComboBox1.SelectedIndex > 0)
                        {
                            RadComboBox1.SelectedIndex -= 1;
                            currentItem = RadComboBox1.Items[RadComboBox1.SelectedIndex];
                            RadComboBox1.Text = currentItem.Text;
                        }
                        break;
                    }
                case "Link":
                    {
                        currentItem = RadComboBox1.FindItemByText(RadComboBox1.Text);
                        if (currentItem == null)
                        {
                            currentItem = new RadComboBoxItem(RadComboBox1.Text);
                            RadComboBox1.Items.Add(currentItem);
                        }
                        RadComboBox1.SelectedIndex = RadComboBox1.Items.Count - 1;
                        break;
                    }
            }
            pageFrame.Attributes["src"] = RadComboBox1.Text;
        }
    }
}
