public static RadMenu SetLocationList(RadMenu mnu, List <BusinessLocation> locationList, decimal plantID, string topLabel, string topValue, bool enableBUSelect) { ADDRESS address = null; int numOrgs = locationList.Select(l => l.Plant.BUS_ORG_ID).Distinct().Count(); Telerik.Web.UI.RadMenuItem miTop = new Telerik.Web.UI.RadMenuItem(); miTop.Text = topLabel; miTop.Value = "TOP"; miTop.Font.Bold = true; mnu.Items.Add(miTop); decimal busOrgID = 0; Telerik.Web.UI.RadMenuItem miBU = null; foreach (BusinessLocation loc in locationList.OrderBy(l => l.Plant.BUS_ORG_ID).ThenBy(l => l.Plant.PLANT_NAME).ToList()) { if (loc.Plant.BUS_ORG_ID != busOrgID) { if (miBU != null) { miTop.Items.Add(miBU); } busOrgID = (decimal)loc.Plant.BUS_ORG_ID; miBU = new Telerik.Web.UI.RadMenuItem(); miBU.ImageUrl = "~/images/defaulticon/16x16/sitemap.png"; miBU.Text = loc.BusinessOrg.ORG_NAME; miBU.Value = "BU" + loc.BusinessOrg.BUS_ORG_ID.ToString(); if (!enableBUSelect) { ; // how to disable selecting ?? } } Telerik.Web.UI.RadMenuItem miLoc = new Telerik.Web.UI.RadMenuItem(); miLoc.Text = loc.Plant.PLANT_NAME; miLoc.Value = loc.Plant.PLANT_ID.ToString(); if ((address = loc.Plant.ADDRESS.FirstOrDefault()) != null) { miLoc.ToolTip = address.STREET1 + " " + address.CITY; } miBU.Items.Add(miLoc); if (plantID > 0 && plantID.ToString() == miLoc.Value) // is default plant { miLoc.Selected = true; mnu.Items[0].Text = miLoc.Text; } } if (miBU != null) { miTop.Items.Add(miBU); } return(mnu); }
protected void resultsMenu_ItemClick(object sender, RadMenuEventArgs e) { Telerik.Web.UI.RadMenuItem ItemClicked = e.Item; string clickedItem = Convert.ToString(ItemClicked.Text); if (clickedItem == "Word") { RadGrid1.ExportSettings.IgnorePaging = true; RadGrid1.ExportSettings.OpenInNewWindow = true; RadGrid1.MasterTableView.ExportToWord(); } else if (clickedItem == "CSV") { RadGrid1.ExportSettings.IgnorePaging = true; RadGrid1.ExportSettings.OpenInNewWindow = true; RadGrid1.MasterTableView.ExportToCSV(); } else if (clickedItem == "Download To Excel") { RadGrid1.ExportSettings.ExportOnlyData = true; RadGrid1.ExportSettings.IgnorePaging = true; RadGrid1.ExportSettings.OpenInNewWindow = true; RadGrid1.ExportSettings.FileName = "SMS_Message_Log_run=" + DateTime.Now; RadGrid1.MasterTableView.ExportToExcel(); } else if (clickedItem == "PDF") { RadGrid1.ExportSettings.IgnorePaging = true; RadGrid1.ExportSettings.OpenInNewWindow = true; RadGrid1.MasterTableView.ExportToPdf(); } else if (clickedItem == "Reset") { Response.Redirect(Request.Url.ToString()); } }