///	<summary>
        ///	Called by the tool pane to apply property changes to the selected Web Part.
        ///	</summary>
        public override void ApplyChanges()
        {
            try
            {
                EnsureChildControls();
                // apply property values here
                BaseListWebPart wp = this.ParentToolPane.SelectedWebPart as BaseListWebPart;

                wp.ListWebUrl   = this.WebUrlTextBox.Text;
                wp.ListName     = this.AvailableListsDropDownList.SelectedValue;
                wp.ListViewName = this.AvailableViewsDropDownList.SelectedValue;
            }
            catch (Exception ex) { System.Diagnostics.Debug.Write(ex.ToString()); }
        }
        void LoadViews()
        {
            try
            {
                BaseListWebPart wp = this.ParentToolPane.SelectedWebPart as BaseListWebPart;

                EnsureChildControls();
                AvailableViewsDropDownList.Items.Clear();

                SPWeb web;
                if (WebUrlTextBox.Text.Trim() == string.Empty)
                {
                    web = Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context);
                }
                else
                {
                    SPSite st = new SPSite(new Uri(Page.Request.Url, WebUrlTextBox.Text, true).ToString());
                    st.CatchAccessDeniedException = false;
                    web = st.OpenWeb();
                }

                WebUrlTextBox.Text            = web.Url;
                web.Lists.ListsForCurrentUser = true;
                SPList list = web.Lists[this.AvailableListsDropDownList.SelectedValue];

                foreach (SPView vi in list.Views)
                {
                    if (vi.Title.Trim() != string.Empty)
                    {
                        AvailableViewsDropDownList.Items.Add(vi.Title);
                    }

                    if (wp.ListViewName == vi.Title)
                    {
                        AvailableViewsDropDownList.SelectedIndex = AvailableViewsDropDownList.Items.Count - 1;
                    }
                }
            }
            catch (Exception ex) { System.Diagnostics.Debug.Write(ex.ToString()); }
        }
        /// <summary>
        /// Loads the values fro mth eweb part.
        /// Use force=true to force replace of view state values.
        /// </summary>
        /// <param name="force">Override values</param>
        void LoadWebPartProperties(bool force)
        {
            this.EnsureChildControls();

            if (force || ViewState["ListConnectionToolPartLoaded" + this.Qualifier] == null || (bool)ViewState["ListConnectionToolPartLoaded" + this.Qualifier] != true)
            {
                ViewState["ListConnectionToolPartLoaded" + this.Qualifier] = true;

                BaseListWebPart wp = this.ParentToolPane.SelectedWebPart as BaseListWebPart;

                if (force || this.WebUrlTextBox.Text == string.Empty)
                {
                    if (wp.ListWebUrl.Trim() == string.Empty)
                    {
                        WebUrlTextBox.Text = Microsoft.SharePoint.WebControls.SPControl.GetContextWeb(Context).Url;
                    }
                    else
                    {
                        WebUrlTextBox.Text = wp.ListWebUrl;
                    }
                    LoadListButton_Click(null, null);
                }
            }
        }