コード例 #1
0
            public void InstantiateIn(Control container)
            {
                RadTabStrip tabControl = new RadTabStrip();

                tabControl.ID = "tabControl";
                container.Controls.Add(tabControl);
            }
コード例 #2
0
ファイル: Customer.aspx.cs プロジェクト: PatrickSearcey/SiFTA
        private void initializeTabStrip(RadTabStrip rts, RadMultiPage rmp)
        {
            string selected = Request.QueryString["selected"];

            if (!String.IsNullOrEmpty(selected))
            {
                try {
                    //Convert it to an integer
                    var selectedIndex = Convert.ToInt32(selected);
                    //Check to see if it is in an appropriate range for the page
                    if (selectedIndex >= 0 && selectedIndex <= rts.Tabs.Count() - 1)
                    {
                        rts.SelectedIndex = selectedIndex;
                        rmp.SelectedIndex = selectedIndex;
                    }
                    else
                    {
                        rts.SelectedIndex = 0; rmp.SelectedIndex = 0;
                    }
                }
                catch (Exception ex) { rts.SelectedIndex = 0; rmp.SelectedIndex = 0; }
            }
            else
            {
                rts.SelectedIndex = 0;
                rmp.SelectedIndex = 0;
            }
        }
コード例 #3
0
 public static void OcultarPestanyas(RadTabStrip rdts)
 {
     foreach (RadTab rd in rdts.Tabs)
     {
         rd.Visible = false;
     }
     rdts.Tabs[0].Visible = true;
 }
コード例 #4
0
 // Other
 protected void TerritoryLimit(RadTabStrip ts)
 {
     ts.Enabled = true;
     for (int i = 0; i < ts.Tabs.Count; i++)
     {
         if (!RoleAdapter.IsUserInRole("db_8-WeekReportTL" + ts.Tabs[i].Text.Replace(" ", "")))
         {
             ts.Tabs.RemoveAt(i);
             i--;
         }
     }
 }
コード例 #5
0
 protected void lbtnD_Click(object sender, EventArgs e)
 {
     surveyDataClassDataContext.hitbl_Survey_Page_SPGs.DeleteOnSubmit(currentPage);
     surveyDataClassDataContext.SubmitChanges();
     if (Settings.ContainsKey("currentPageTab"))
     {
         //Set the Parent's AddNew Button visibilirty to true
         RadTab      currentPageTab = Settings["currentPageTab"] as RadTab;
         RadTabStrip rts            = currentPageTab.TabStrip;
         rts.Tabs.Remove(currentPageTab);
     }
 }
コード例 #6
0
        protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
        {
            RadTabStrip  rtabstrip = RadTabStrip1;
            RadMultiPage rmultipg  = rtabstrip.MultiPage;

            if (e.Tab.Text == "Search Customer")
            {
                ViewState["tabselected"] = 1;
            }
            else
            {
                ViewState["tabselected"] = 0;
            }
        }
コード例 #7
0
 protected void TerritoryLimit(RadTabStrip ts)
 {
     ts.Enabled = true;
     if (Roles.IsUserInRole("db_StatusSummaryTL"))
     {
         for (int i = 0; i < ts.Tabs.Count; i++)
         {
             if (!Roles.IsUserInRole("db_StatusSummaryTL" + ts.Tabs[i].Text.Replace(" ", "")))
             {
                 ts.Tabs.RemoveAt(i);
                 i--;
             }
         }
     }
 }
コード例 #8
0
        /// <summary>
        /// Hides the inaccessible tabs.
        /// </summary>
        /// <param name="tabs">The tabs.</param>
        /// <param name="multipage">The multipage.</param>
        public void HideInaccessibleTabs(ref RadTabStrip tabs, ref RadMultiPage multipage)
        {
            var dataManager = new DataManager();
            var user        = dataManager.User.SelectById(CurrentUser.Instance.ID);

            for (int i = 0; i < tabs.Tabs.Count; i++)
            {
                if (!string.IsNullOrEmpty(tabs.Tabs[i].Value))
                {
                    var access = Access.Check(user, tabs.Tabs[i].Value);
                    if (!access.Read)
                    {
                        tabs.Tabs[i].Visible           = false;
                        multipage.PageViews[i].Visible = false;
                    }
                }
            }
        }
コード例 #9
0
        /// <summary>
        /// Handles the ItemDataBound event of the DetailsView control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.RadListViewItemEventArgs"/> instance containing the event data.</param>
        private void DetailsView_ItemDataBound(object sender, RadListViewItemEventArgs e)
        {
            if (e.Item.ItemType != RadListViewItemType.DataItem && e.Item.ItemType != RadListViewItemType.AlternatingItem)
            {
                return;
            }

            RealEstateItem item = ((RadListViewDataItem)e.Item).DataItem as RealEstateItem;

            if (item == null)
            {
                return;
            }

            #region Contact Our Agent
            RadTabStrip  tabStrip           = (RadTabStrip)e.Item.FindControl("tabStrip");
            RadMultiPage multiPage          = (RadMultiPage)e.Item.FindControl("multiPage");
            RadTab       tabContactOurAgent = tabStrip.Tabs[5];

            if (tabContactOurAgent != null && !item.AgentId.Equals(Guid.Empty))
            {
                AgentItem agent = this.AgentsManager.GetAgent(item.AgentId);
                if (agent != null)
                {
                    tabContactOurAgent.NavigateUrl = AGENTS_PAGE + this.AgentsManager.GetItemUrl(agent);
                }
                else
                {
                    tabContactOurAgent.Visible     = false;
                    multiPage.PageViews[5].Visible = false;
                }
            }
            else
            {
                tabContactOurAgent.Visible     = false;
                multiPage.PageViews[5].Visible = false;
            }
            #endregion

            RadListView  rlvOverview       = (RadListView)e.Item.FindControl("rlvOverview");
            List <Photo> overviewTabPhotos = item.GetPhotos(MultiplePhotoType.OverviewTabPhoto);
            rlvOverview.DataSource = overviewTabPhotos;
            rlvOverview.DataBind();
            tabStrip.Tabs[0].Visible       = (overviewTabPhotos.Count > 0);
            multiPage.PageViews[0].Visible = tabStrip.Tabs[0].Visible;

            RadListView  rlvPhotos       = (RadListView)e.Item.FindControl("rlvPhotos");
            List <Photo> photosTabPhotos = item.GetPhotos(MultiplePhotoType.PhotosTabPhoto);
            rlvPhotos.DataSource = photosTabPhotos;
            rlvPhotos.DataBind();
            tabStrip.Tabs[1].Visible       = (photosTabPhotos.Count > 0);
            multiPage.PageViews[1].Visible = tabStrip.Tabs[1].Visible;

            RadListView  rlvPanaromicView       = (RadListView)e.Item.FindControl("rlvPanaromicView");
            List <Photo> panaromicViewTabPhotos = item.GetPhotos(MultiplePhotoType.PanaromicViewTabPhoto);
            rlvPanaromicView.DataSource = panaromicViewTabPhotos;
            rlvPanaromicView.DataBind();
            tabStrip.Tabs[2].Visible       = (panaromicViewTabPhotos.Count > 0);
            multiPage.PageViews[2].Visible = tabStrip.Tabs[2].Visible;

            RadListView  rlvFloorPlan       = (RadListView)e.Item.FindControl("rlvFloorPlan");
            List <Photo> floorPlanTabPhotos = item.GetPhotos(MultiplePhotoType.FloorPlanTabPhoto);
            rlvFloorPlan.DataSource = floorPlanTabPhotos;
            rlvFloorPlan.DataBind();
            tabStrip.Tabs[3].Visible       = (floorPlanTabPhotos.Count > 0);
            multiPage.PageViews[3].Visible = tabStrip.Tabs[3].Visible;

            if (item.Latitude <= 0 || item.Longitude <= 0)
            {
                tabStrip.Tabs[4].Visible       = false;
                multiPage.PageViews[4].Visible = false;
            }

            for (int i = 0; i < tabStrip.Tabs.Count; i++)
            {
                if (tabStrip.Tabs[i].Visible)
                {
                    tabStrip.SelectedIndex  = i;
                    multiPage.SelectedIndex = i;

                    this.Page.ClientScript.RegisterClientScriptBlock(
                        this.GetType(), "initialTabStripId",
                        string.Format("var initialTabStripId = '{0}';", multiPage.PageViews[i].ClientID), true);

                    break;
                }
            }

            Panel pnlPrice = (Panel)e.Item.FindControl("pnlPrice");
            pnlPrice.Controls.Clear();
            pnlPrice.Controls.Add(new Literal()
            {
                Text = item.Price.ToString("n2")
            });

            if (!item.Description.Value.IsNullOrEmpty())
            {
                PlaceHolder phDescription = (PlaceHolder)e.Item.FindControl("phDescription");
                phDescription.Visible = true;
            }

            #region Location
            FlatTaxon locationTaxon = item.GetTaxon <FlatTaxon>(TaxonType.Locations);
            if (locationTaxon != null)
            {
                Literal ltrLocation = (Literal)e.Item.FindControl("ltrLocation");

                ltrLocation.Text = locationTaxon.Title;
            }
            #endregion

            #region Item Type
            FlatTaxon itemTypeTaxon = item.GetTaxon <FlatTaxon>(TaxonType.Types);
            if (itemTypeTaxon != null)
            {
                PlaceHolder phItemType  = (PlaceHolder)e.Item.FindControl("phItemType");
                Literal     ltrItemType = (Literal)e.Item.FindControl("ltrItemType");

                ltrItemType.Text   = itemTypeTaxon.Title;
                phItemType.Visible = true;
            }
            #endregion

            #region Housing
            if (!item.Housing.IsNullOrEmpty())
            {
                PlaceHolder phHousing  = (PlaceHolder)e.Item.FindControl("phHousing");
                Literal     ltrHousing = (Literal)e.Item.FindControl("ltrHousing");
                ltrHousing.Text   = string.Format("{0} m<sup>2</sup>", item.Housing);
                phHousing.Visible = true;
            }
            #endregion

            #region Rooms
            if (!item.NumberOfRooms.IsNullOrEmpty())
            {
                PlaceHolder phRooms  = (PlaceHolder)e.Item.FindControl("phRooms");
                Literal     ltrRooms = (Literal)e.Item.FindControl("ltrRooms");
                ltrRooms.Text   = item.NumberOfRooms;
                phRooms.Visible = true;
            }
            #endregion

            #region Floors
            if (!item.NumberOfFloors.IsNullOrEmpty())
            {
                PlaceHolder phFloors  = (PlaceHolder)e.Item.FindControl("phFloors");
                Literal     ltrFloors = (Literal)e.Item.FindControl("ltrFloors");
                ltrFloors.Text   = item.NumberOfFloors;
                phFloors.Visible = true;
            }
            #endregion

            #region Built
            if (!item.YearBuilt.IsNullOrEmpty())
            {
                PlaceHolder phBuilt  = (PlaceHolder)e.Item.FindControl("phBuilt");
                Literal     ltrBuilt = (Literal)e.Item.FindControl("ltrBuilt");
                ltrBuilt.Text   = item.YearBuilt;
                phBuilt.Visible = true;
            }
            #endregion

            #region Payment
            if (item.Payment > 0)
            {
                PlaceHolder phPayment  = (PlaceHolder)e.Item.FindControl("phPayment");
                Literal     ltrPayment = (Literal)e.Item.FindControl("ltrPayment");
                ltrPayment.Text   = item.Payment.ToString("n2");
                phPayment.Visible = true;
            }
            #endregion

            #region MonthlyRate
            if (item.MonthlyRate > 0)
            {
                PlaceHolder phMonthlyRate  = (PlaceHolder)e.Item.FindControl("phMonthlyRate");
                Literal     ltrMonthlyRate = (Literal)e.Item.FindControl("ltrMonthlyRate");
                ltrMonthlyRate.Text   = item.MonthlyRate.ToString("n2");
                phMonthlyRate.Visible = true;
            }
            #endregion

            #region Net
            if (item.Net > 0)
            {
                PlaceHolder phNet  = (PlaceHolder)e.Item.FindControl("phNet");
                Literal     ltrNet = (Literal)e.Item.FindControl("ltrNet");
                ltrNet.Text   = item.Net.ToString("n2");
                phNet.Visible = true;
            }
            #endregion

            #region PriceSquareMeter
            if (item.PriceSquareMeter > 0)
            {
                PlaceHolder phPriceSquareMeter  = (PlaceHolder)e.Item.FindControl("phPriceSquareMeter");
                Literal     ltrPriceSquareMeter = (Literal)e.Item.FindControl("ltrPriceSquareMeter");
                ltrPriceSquareMeter.Text   = item.PriceSquareMeter.ToString("n2");
                phPriceSquareMeter.Visible = true;
            }
            #endregion

            RadListView FeaturesList = (RadListView)e.Item.FindControl("FeaturesList");
            FeaturesList.ItemDataBound += new EventHandler <RadListViewItemEventArgs>(FeaturesList_ItemDataBound);
            FeaturesList.DataSource     = item.GetTaxons <FlatTaxon>(TaxonType.Features);
            FeaturesList.DataBind();

            RadListView RoomsList = (RadListView)e.Item.FindControl("RoomsList");
            RoomsList.ItemDataBound += new EventHandler <RadListViewItemEventArgs>(RoomsList_ItemDataBound);
            RoomsList.DataSource     = item.GetTaxons <FlatTaxon>(TaxonType.Rooms);
            RoomsList.DataBind();

            #region Agent
            if (!item.AgentId.Equals(Guid.Empty))
            {
                AgentItem agent = this.AgentsManager.GetAgent(item.AgentId);

                if (agent != null)
                {
                    PlaceHolder phAgent = (PlaceHolder)e.Item.FindControl("phAgent");
                    phAgent.Visible = true;

                    Literal ltrAgentName = (Literal)e.Item.FindControl("ltrAgentName");
                    ltrAgentName.Text = agent.Title;


                    #region Address
                    if (!agent.Address.IsNullOrEmpty())
                    {
                        PlaceHolder phAgentAddress  = (PlaceHolder)e.Item.FindControl("phAgentAddress");
                        Literal     ltrAgentAddress = (Literal)e.Item.FindControl("ltrAgentAddress");
                        ltrAgentAddress.Text   = agent.Address;
                        phAgentAddress.Visible = true;
                    }
                    #endregion

                    #region PhoneNumber
                    if (!agent.PhoneNumber.IsNullOrEmpty())
                    {
                        PlaceHolder phAgentPhoneNumber  = (PlaceHolder)e.Item.FindControl("phAgentPhoneNumber");
                        Literal     ltrAgentPhoneNumber = (Literal)e.Item.FindControl("ltrAgentPhoneNumber");
                        ltrAgentPhoneNumber.Text   = agent.PhoneNumber;
                        phAgentPhoneNumber.Visible = true;
                    }
                    #endregion


                    #region Email
                    if (!agent.Email.IsNullOrEmpty())
                    {
                        PlaceHolder phAgentEmail = (PlaceHolder)e.Item.FindControl("phAgentEmail");
                        HyperLink   hlAgentEmail = (HyperLink)e.Item.FindControl("hlAgentEmail");
                        hlAgentEmail.Text        = agent.Email;
                        hlAgentEmail.NavigateUrl = tabContactOurAgent.NavigateUrl;
                        phAgentEmail.Visible     = true;
                    }
                    #endregion
                }
            }
            #endregion
        }
コード例 #10
0
    // Set the controls by the value of the parameters
    private void SetControlObjectByValue(Control aControl, string aValue)
    {
        string _type = aControl.GetType().Name;

        if (_type == "RadTextBox")
        {
            RadTextBox _box = (RadTextBox)aControl;
            _box.Text = aValue;
        }
        else if (_type == "RadDropDownList")
        {
            RadDropDownList  _list = (RadDropDownList)aControl;
            DropDownListItem _item = _list.FindItemByValue(aValue);
            int _selectedIndex     = 0;
            if (_item != null)
            {
                _selectedIndex = _item.Index;
            }
            _list.SelectedIndex = _selectedIndex;
        }
        else if (_type == "RadNumericTextBox")
        {
            RadNumericTextBox _numeric = (RadNumericTextBox)aControl;
            _numeric.Value = Convert.ToDouble(aValue);
        }
        else if (_type == "RadSearchBox")
        {
            RadSearchBox _search = (RadSearchBox)aControl;
            if (aValue.Contains('^'))
            {
                string[] _splitForContext = aValue.Split('^');
                _search.Text = _splitForContext[0].Trim();
                int _selectedCtx = Convert.ToInt32(_splitForContext[1].Trim());
                if (_selectedCtx != -1)
                {
                    _search.SearchContext.Items[_selectedCtx].Selected = true;
                }
            }
            else
            {
                _search.Text = aValue;
            }
        }
        else if (_type == "RadComboBox")
        {
            RadComboBox _combo = (RadComboBox)aControl;
            if (_combo.CheckBoxes)
            {
                for (int i = 0; i < _combo.Items.Count; i++)
                {
                    _combo.Items[i].Checked = aValue[i] == '1';
                }
            }
            else
            {
                RadComboBoxItem _item = _combo.FindItemByValue(aValue);
                if (_item != null)
                {
                    _item.Selected = true;
                }
                else
                {
                    _combo.Text = aValue;
                }
            }
        }
        else if (_type == "RadButton")
        {
            RadButton _button = (RadButton)aControl;

            // TODO: Set all checks here
            if (_button.ToggleType == ButtonToggleType.CustomToggle)
            {
                _button.SelectedToggleStateIndex = Convert.ToInt32(aValue);
            }

            // For everything else
            else
            {
                _button.Checked = aValue == "1";
            }
        }
        else if (_type == "RadDatePicker")
        {
            RadDatePicker _date = (RadDatePicker)aControl;
            _date.SelectedDate = DateTime.Parse(aValue);
        }
        else if (_type == "RadTabStrip")
        {
            RadTabStrip _tabstrip = (RadTabStrip)aControl;
            int         _index    = Convert.ToInt32(aValue);
            _tabstrip.SelectedIndex           = _index;
            _tabstrip.MultiPage.SelectedIndex = _index;
        }
    }
コード例 #11
0
    // Gets the value used by the control
    private string GetControlValue(Control aControl)
    {
        string _value = null;

        //Find the control type
        string _type = aControl.GetType().Name;

        if (_type == "RadTextBox")
        {
            RadTextBox _box = (RadTextBox)aControl;
            if (!String.IsNullOrEmpty(_box.Text))
            {
                _value = _box.Text;
            }
        }
        else if (_type == "RadDropDownList")
        {
            RadDropDownList _list = (RadDropDownList)aControl;
            if (_list.SelectedIndex != 0)
            {
                _value = _list.SelectedValue;
            }
        }
        else if (_type == "RadNumericTextBox")
        {
            RadNumericTextBox _numeric = (RadNumericTextBox)aControl;
            if (!String.IsNullOrEmpty(_numeric.Value.ToString()))
            {
                _value = _numeric.Value.ToString();
            }
        }
        else if (_type == "RadSearchBox")
        {
            RadSearchBox _search = (RadSearchBox)aControl;
            if (!String.IsNullOrEmpty(_search.Text))
            {
                _value = _search.Text;
                if (_search.SearchContext.Items.Count != 0)
                {
                    _value += "^" + _search.SearchContext.SelectedIndex;
                }
            }
        }
        //TODO: Multichecklist - what do
        // Comboboxes can be hard. this might need rework in later future
        else if (_type == "RadComboBox")
        {
            RadComboBox _combo = (RadComboBox)aControl;
            // if the combobox includes checkboxes
            if (_combo.CheckBoxes)
            {
                foreach (RadComboBoxItem _item in _combo.Items)
                {
                    // return the value as 1 or 0 ( checked / unchecked )
                    _value += _item.Checked ? "1" : "0";
                }
            }

            else if (!String.IsNullOrEmpty(_combo.SelectedValue))
            {
                _value = _combo.SelectedValue;
            }
        }
        else if (_type == "RadButton")
        {
            RadButton _button = (RadButton)aControl;

            // TODO: Set all checks here
            if (_button.ToggleType == ButtonToggleType.CustomToggle)
            {
                _value = _button.SelectedToggleStateIndex.ToString();
            }

            // For everything else
            else
            {
                _value = _button.Checked ? "1" : "0";
            }
        }
        else if (_type == "RadDatePicker")
        {
            RadDatePicker _date = (RadDatePicker)aControl;
            // Use icelandic dates
            if (_date.SelectedDate != null)
            {
                _value = ((DateTime)_date.SelectedDate).ToString("dd.MM.yyyy");
            }
        }
        else if (_type == "RadTabStrip")
        {
            RadTabStrip _tabstrip = (RadTabStrip)aControl;
            _value = _tabstrip.SelectedIndex.ToString();
        }

        return(_value);
    }