protected void Adons_ItemDataBound(object sender, RadListViewItemEventArgs e) { if (e.Item is RadListViewDataItem) { RadListViewDataItem item = e.Item as RadListViewDataItem; ProductAdon obj = item.DataItem as ProductAdon; if (obj != null) { Label adonname = item.FindControl("txtAdonName") as Label; adonname.Text = obj.Adon.AdOnName; if (obj.AdOnTypeInProduct.DisplayFormat == 1) { RadioButtonList adonoptions = item.FindControl("AdonOptions") as RadioButtonList; DefaultSelected(item, obj.DefaultSelected); } else if (obj.AdOnTypeInProduct.DisplayFormat == 2) { RadioButton AdonRadioButton = item.FindControl("AdonRadioButton") as RadioButton; AdonRadioButton.Visible = true; } else if (obj.AdOnTypeInProduct.DisplayFormat == 3) { CheckBox AdonCheckBox = item.FindControl("AdonCheckBox") as CheckBox; AdonCheckBox.Visible = true; } else if (obj.AdOnTypeInProduct.DisplayFormat == 4) { DefaultSelected(item, obj.DefaultSelected, false, false, false); } } } }
protected void RadListView1_ItemDataBound(object sender, Telerik.Web.UI.RadListViewItemEventArgs e) { if ((e.Item.ItemType == RadListViewItemType.DataItem) || (e.Item.ItemType == RadListViewItemType.AlternatingItem)) { RadListViewDataItem item = e.Item as RadListViewDataItem; Label lblUniq = ((Label)item.FindControl("lblUniq")); ImageButton btnMore = ((ImageButton)item.FindControl("btnMore")); btnMore.Attributes.Add("OnClick", "return ShowEditForm('" + lblUniq.Text.Trim() + "');"); } }
protected void RadListViewImages_ItemDataBound(object sender, Telerik.Web.UI.RadListViewItemEventArgs e) { RadListViewDataItem item = e.Item as RadListViewDataItem; string description = (item.DataItem as Image).Description; if (description.Length > 100) { description = description.Substring(0, 97) + "..."; (item.FindControl("LabelShortDescription") as Literal).Text = description; } }
private void UnSelectOtherSize(RadListViewDataItem childitem, Int16 selectedSize) { ImageButton None = childitem.FindControl("None") as ImageButton; ImageButton First = childitem.FindControl("First") as ImageButton; ImageButton Full = childitem.FindControl("Full") as ImageButton; ImageButton Second = childitem.FindControl("Second") as ImageButton; ImageButton Double = childitem.FindControl("Double") as ImageButton; switch (selectedSize) { case 0: First.CommandName = Full.CommandName = Second.CommandName = Double.CommandName = "1"; First.ImageUrl = "~/image/FirstHalf_NotSelected.png"; Full.ImageUrl = "~/image/Full_NotSelected.png"; Second.ImageUrl = "~/image/2ndHalf_NotSelected.png"; Double.ImageUrl = "~/image/Double_NotSelected.png"; break; case 1: None.CommandName = First.CommandName = Second.CommandName = "1"; None.ImageUrl = "~/image/None-NotSelected.png"; First.ImageUrl = "~/image/FirstHalf_NotSelected.png"; Second.ImageUrl = "~/image/2ndHalf_NotSelected.png"; break; case 2: None.CommandName = Full.CommandName = Second.CommandName = "1"; None.ImageUrl = "~/image/None-NotSelected.png"; Full.ImageUrl = "~/image/Full_NotSelected.png"; Second.ImageUrl = "~/image/2ndHalf_NotSelected.png"; break; case 3: None.CommandName = First.CommandName = Second.CommandName = "1"; None.ImageUrl = "~/image/None-NotSelected.png"; First.ImageUrl = "~/image/FirstHalf_NotSelected.png"; Full.ImageUrl = "~/image/Full_NotSelected.png"; break; } }
protected void txtAdonsList_ItemDataBound(object sender, RadListViewItemEventArgs e) { if (e.Item is RadListViewDataItem) { RadListViewDataItem item = e.Item as RadListViewDataItem; AdOnTypeInProduct obj = item.DataItem as AdOnTypeInProduct; RadListView adons = item.FindControl("txtAdons") as RadListView; Panel AdonHeading = item.FindControl("AdonHeading") as Panel; Panel NoneFullHeading = item.FindControl("NoneFullHeading") as Panel; adons.DataSource = obj.ProductAdons.OrderBy(pd => pd.Adon.AdOnName); adons.DataBind(); if (obj.DisplayFormat == 1) { AdonHeading.Visible = true; } else if (obj.DisplayFormat == 4) { NoneFullHeading.Visible = true; } } }
protected void txtOptions_ItemDataBound(object sender, RadListViewItemEventArgs e) { if (e.Item is RadListViewDataItem) { RadListViewDataItem item = e.Item as RadListViewDataItem; OptionTypesInProduct obj = item.DataItem as OptionTypesInProduct; List <ProductOption> optionlist = (from po in entities.ProductOptions select po).ToList(); var results = (from po in optionlist join pop in obj.ProductOptionsInProducts on po.OptionID equals pop.ProductOptionID orderby pop.DisplayOrder select new { po.OptionName, pop.ProductOptionsInProductID }).ToList(); if (obj.IsMultiSelect) { CheckBoxList chklist = item.FindControl("CheckBoxList") as CheckBoxList; if (obj.IsSamePrice) { chklist.AutoPostBack = false; } chklist.DataSource = results; chklist.DataBind(); } else { RadioButtonList radiolist = item.FindControl("RadioButtonList") as RadioButtonList; RequiredFieldValidator rfvOptionSelect = item.FindControl("rfvOptionSelect") as RequiredFieldValidator; if (obj.IsSamePrice) { radiolist.AutoPostBack = false; } rfvOptionSelect.Visible = true; radiolist.DataSource = results; radiolist.DataBind(); } } }
protected void listFoods_ItemDataBound(object sender, Telerik.Web.UI.RadListViewItemEventArgs e) { if (e.Item is RadListViewDataItem) { RadListViewDataItem item = e.Item as RadListViewDataItem; System.Web.UI.WebControls.Button _btnRecommend = item.FindControl("btnRecommend") as System.Web.UI.WebControls.Button; Boolean tmp = Convert.ToBoolean(DataBinder.Eval(item.DataItem, "recommend").ToString()); if (tmp == true) { _btnRecommend.CssClass = "btn btn-warning"; } else { _btnRecommend.CssClass = "btn btn-light"; } } }
private void DefaultSelected(RadListViewDataItem childitem, Int16 defaultSelected, bool showFirstHalf = true, bool showSecondHalf = true, bool showDouble = true) { ImageButton None = childitem.FindControl("None") as ImageButton; ImageButton First = childitem.FindControl("First") as ImageButton; ImageButton Full = childitem.FindControl("Full") as ImageButton; ImageButton Second = childitem.FindControl("Second") as ImageButton; ImageButton Double = childitem.FindControl("Double") as ImageButton; HiddenField SelectedSize = childitem.FindControl("SelectedSize") as HiddenField; First.Visible = showFirstHalf; Second.Visible = showSecondHalf; Double.Visible = showDouble; switch (defaultSelected) { case 0: None.CommandName = "2"; None.ImageUrl = "~/image/None-Selected.png"; break; case 1: Full.CommandName = "2"; Full.ImageUrl = "~/image/Full_Selected.png"; SelectedSize.Value = "1"; None.CommandName = "2"; None.ImageUrl = "~/image/None-NotSelected.png"; break; case 2: First.CommandName = "2"; First.ImageUrl = "~/image/FirstHalf_Selected.png"; SelectedSize.Value = "1"; None.CommandName = "2"; None.ImageUrl = "~/image/None-NotSelected.png"; break; case 3: Second.CommandName = "2"; Second.ImageUrl = "~/image/2ndHalf_Selected.png"; SelectedSize.Value = "1"; None.CommandName = "2"; None.ImageUrl = "~/image/None-NotSelected.png"; break; } }
protected void rlvElem_ItemDataBound(object sender, RadListViewItemEventArgs e) { if (e.Item is RadListViewDataItem) { RadListViewDataItem item = (RadListViewDataItem)e.Item; int element_id = Convert.ToInt32(item.GetDataKeyValue("ElementID")); Label lblRevisedDt = (Label)item.FindControl("lblRevisedDt"); Label lblRevisedBy = (Label)item.FindControl("lblRevisedBy"); //Hide the EXTREMES FOR CURRENT YEAR, PEAK DISCHARGES FOR CURRENT YEAR and FOOTNOTE element by setting panel visibility to false //Change panel background color if WELL CHARACTERISTICS or DATUM element and add icon with tooltip Panel pnlElement = (Panel)item.FindControl("pnlElement"); Image ibIcon = (Image)item.FindControl("ibIcon"); //Create the Revision History link HyperLink hlRevisionHistory = (HyperLink)item.FindControl("hlRevisionHistory"); var elem = currSite.SiteElements.FirstOrDefault(p => p.element_id == element_id); if (elem != null) { lblRevisedDt.Text = String.Format("{0:MM/dd/yyyy}", elem.revised_dt); lblRevisedBy.Text = elem.revised_by.ToString("N/A"); hlRevisionHistory.NavigateUrl = String.Format("{0}StationDoc/Archive.aspx?element_id={1}&site_id={2}", Config.SIMSURL, element_id, currSite.site_id); //Don't show EXTREMES FOR CURRENT YEAR, PEAK DISCHARGES FOR CURRENT YEAR, or FOOTNOTES elements in MANU if (elem.ElementDetail.element_nm.Contains("EXTREMES FOR CURRENT YEAR") || elem.ElementDetail.element_nm.Contains("PEAK DISCHARGES FOR CURRENT YEAR") || elem.ElementDetail.element_nm.Contains("FOOTNOTE")) { pnlElement.Visible = false; } else { pnlElement.Visible = true; } if (elem.ElementDetail.element_nm.Contains("WELL CHARACTERISTICS") || elem.ElementDetail.element_nm.Contains("DATUM")) { pnlElement.CssClass = "remarksElemAlert"; ibIcon.Visible = true; ibIcon.ImageUrl = "../images/cleanicon.png"; } else { pnlElement.CssClass = ""; ibIcon.Visible = false; } //For modal pop-ups to work if (elem.ElementDetail.element_nm.Contains("WELL CHARACTERISTICS")) { rwWC.OpenerElementID = ibIcon.ClientID; } if (elem.ElementDetail.element_nm.Contains("DATUM")) { rwDatum.OpenerElementID = ibIcon.ClientID; } } else { pnlElement.CssClass = ""; ibIcon.Visible = false; } } }
protected void ThreadsListView_ItemDataBound(object sender, RadListViewItemEventArgs e) { if (e.Item is RadListViewDataItem) { RadListViewDataItem item = e.Item as RadListViewDataItem; DataRowView rowView = item.DataItem as DataRowView; String Thread_ID = rowView["Thread_ID"].ToString(); String TopicID = ATC.Tools.URLParam("TopicID"); /* Check if the thread is inactive and display the relevant label*/ if (rowView["ThreadActive"].ToString().Equals("0")) { Label inactive = item.FindControl("InactiveThreadLbl") as Label; inactive.Visible = true; } /* Check if hotness icon should be displayed */ /* if (isThreadHot(Thread_ID)) * { * HtmlGenericControl hotThread = item.FindControl("hotThread") as HtmlGenericControl; * hotThread.Visible = true; * hotThread.Attributes.Add("class", "hotness_" + culture); * hotThread.Attributes.Add("title", Localization.GetString("hotness", LocalResourceFile)); * }*/ /* Check which flag to display */ /* HtmlGenericControl topicLang = item.FindControl("topicLang") as HtmlGenericControl; * Label nationalLbl = item.FindControl("nationalLbl") as Label; * * if (rowView["EuRelated"].ToString() == "True") * { * nationalLbl.Text = Localization.GetString("ThreadEu", LocalResourceFile); * topicLang.Attributes.Add("class", "Topicflag tf_en-GB"); * } * else * { * nationalLbl.Text = Localization.GetString("ThreadNational", LocalResourceFile); * topicLang.Attributes.Add("class", "Topicflag tf_" + rowView["Language"]); * } */ /* Set the url of the user's profile link */ HyperLink Thread_UserLink = item.FindControl("Thread_UserLink") as HyperLink; Thread_UserLink.NavigateUrl = DotNetNuke.Common.Globals.UserProfileURL(Convert.ToInt32(rowView["Thread_User_ID"].ToString())); /* Show edit Topic Link if the user has edit permissions */ if (DotNetNuke.Security.PortalSecurity.IsInRoles("Pilot Leaders") || (Request.IsAuthenticated && getUserIdByThread(Thread_ID).Equals(UserId.ToString()))) { /* Edit thread link */ HyperLink editLink = item.FindControl("EditLink") as HyperLink; editLink.NavigateUrl = ConfigurationManager.AppSettings["DomainName"] + "/tabid/" + PortalSettings.ActiveTab.TabID + "/ctl/Edit/mid/" + ModuleId + "/TopicID/" + TopicID + "/ThreadID/" + Thread_ID + /*"/language/" + culture + */ "/default.aspx"; editLink.ImageUrl = ATC.Tools.GetParam("RootURL") + "Images/manage-icn.png"; editLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(editLink.NavigateUrl, this, PortalSettings, true, false)); editLink.Visible = true; } /* Ask for details of the latest post of this Topic */ DataRow lastPost = getLatestPostOfThread(Thread_ID); string lastMessage = String.Empty; string lastMessageUsername = String.Empty; string lastMessageDate = String.Empty; string lastMessageThreadTitle = String.Empty; string lastMessageThreadId = String.Empty; int lastMessageUserID = 1; bool hideLatestLabels = false; if (lastPost != null) { lastMessage = TruncateAtWord(Server.HtmlDecode(lastPost["Subject"].ToString()), 90); if (lastMessage != "") { lastMessageUsername = lastPost["Username"].ToString(); lastMessageDate = lastPost["PostDate"].ToString(); lastMessageUserID = Convert.ToInt32(lastPost["UserID"]); Label LastMessage = item.FindControl("LastMessage") as Label; Label LastMsgDate = item.FindControl("LastMsgDate") as Label; HyperLink userProfile = item.FindControl("userProfile") as HyperLink; HyperLink ThreadofPost = item.FindControl("ThreadofPost") as HyperLink; LastMessage.Text = "\"" + lastMessage + "\""; LastMsgDate.Text = lastMessageDate; userProfile.NavigateUrl = DotNetNuke.Common.Globals.UserProfileURL(lastMessageUserID); userProfile.Text = lastMessageUsername; } else { hideLatestLabels = true; } } else { hideLatestLabels = true; } if (hideLatestLabels) { Label latspostLbl = item.FindControl("latspostLbl") as Label; Label postBy = item.FindControl("postBy") as Label; Label separator1 = item.FindControl("separator1") as Label; latspostLbl.Visible = false; postBy.Visible = false; separator1.Visible = false; } } }