I have a page with one radgrid on it. This page contains different sets of columns depending on how the user gets to the page. In all cases the grid offers Grouping. Since I cannot declare the columns ahead of time and I allow the user to group by whatever he/she chooses, how can i get specific columns to show aggregates in the group footers when grouping is active?
I can get footers to contain text by doing something simple like:
| Protected Sub Radgrid_ItemDataBound(ByVal source As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound |
| If TypeOf e.Item Is GridGroupFooterItem Then |
| Dim footer As GridGroupFooterItem = e.Item |
| Try |
| footer("ReworkCosts").Text = "Sum of Rework Costs: $" |
| Catch ex As Exception |
| End Try |
| Try |
| footer("MaterialCosts").Text = "Sum of Material Costs: $" |
| Catch ex As Exception |
| End Try |
| Try |
| footer("ScrapCosts").Text = "Sum of Scrap Costs: $" |
| Catch ex As Exception |
| End Try |
| Try |
| footer("DefectCosts").Text = "Sum of Defect Costs: $" |
| Catch ex As Exception |
| End Try |
| Try |
| footer("QNote").Text = "Count of Qnotes: " |
| Catch ex As Exception |
| End Try |
| Try |
| footer("MRCs").Text = "Count of MRCs: " |
| Catch ex As Exception |
| End Try |
| Try |
| footer("SCARs").Text = "Count of SCARs: " |
| Catch ex As Exception |
| End Try |
| End If |
| End Sub |
...but I don't know how to access all of the items in a specific column of that group so that I can add/count them and concatenate themm to the end of my string.
Any recommendations?
I am using VB.NET, .NET 3.5
| protected void gridFavorites_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item.DataItem != null) |
| { |
| IFavorite fav = (IFavorite)e.Item.DataItem; |
| if (fav.CmsPageId == Guid.Empty) |
| // Where to go from here to set readonly=true? |
| } |
| } |
| $find("<%= grdEntityAttributes.ClientID %>").get_masterTableView().get_dataItems()[document.getElementById("selectedRow").value] |
Hi There,
I've upgrade my project to Microsoft Enterprise Library 5.0 (former version was 4.1) but I got a runtime error when the Rad Grid is binding.
My code is something like below:
| public static IDataReader GetAllOrders() |
| { |
| SqlDatabase db = new SqlDatabase(connString); |
| return db.ExecuteReader("Orders_GetAll"); |
| } |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| shopGrid.DataSource = DataProvider.GetAllShopOrders(); |
| shopGrid.DataBind(); |
| } |
End I get this error:
Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource.
I didn't have this problem with Microsoft Enterprise Library 4.1 or lower.
| $(document).ready( function() |
| { |
| var filtros = $("input[class='rgFilterBox']"); |
| if(filtros.length > 0) |
| { |
| var textoFiltro = document.getElementById("<%= hdFiltro.ClientID %>").value; // Text show |
| for(var i=0; i<filtros.length; i++) |
| { |
| if(filtros[i].value == "") |
| { |
| filtros[i].value = textoFiltro; |
| filtros[i].style.color = "#d6d6d6"; |
| } |
| filtros[i].onfocus = function() { |
| if(this.value==textoFiltro) |
| { |
| this.value = ""; |
| this.style.color = "black"; |
| } |
| } |
| filtros[i].onblur = function() { |
| if(this.value == "") |
| { |
| this.value = textoFiltro; |
| this.style.color = "#d6d6d6"; |
| } |
| } |
| } |
| } |
| }); |
Hi,
I am creating windows dynamically based on the settings I retrieve from database. Need to add some custom properties to the RadWindows so that I can use them while rendering to make decissions, like whether to show it in the minimized mode after its visible(because I've many rad windows popping up on the screen). Attributes which will drive the minimum width and height of the windows, which I'll use in the resize event of the RadWindows.
I've a code sample here, kindly help me understand how I can do this.
| <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %> |
| <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" > |
| <head runat="server"> |
| <title></title> |
| <script type="text/javascript"> |
| function WindowCreatedAndShowed(sender, args) { |
| if (sender.isMinimized == "True") { |
| sender.hide(); |
| } |
| } |
| </script> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <telerik:RadWindowManager ShowOnTopWhenMaximized="false" Width="100%" Height="100%" |
| OnClientActivate="OnClientActivate" OnClientClose="OnClientClose" Behaviors="Close,Maximize,Minimize,Move,Reload,Resize" |
| OnClientCommand="OnClientCommand" ID="DBRadWindowManager" RestrictionZoneID="RestrictionZone" |
| runat="server" Skin="Telerik" OnClientPageLoad="WindowCreatedAndShowed" OnClientResize="OnClientResize"> |
| </telerik:RadWindowManager> |
| </form> |
| </body> |
| </html> |
| using System; |
| using System.Collections.Generic; |
| using System.Linq; |
| using System.Web; |
| using System.Web.UI; |
| using System.Web.UI.WebControls; |
| using Telerik.Web.UI; |
| namespace WebApplication2 |
| { |
| public partial class _Default : System.Web.UI.Page |
| { |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| if (!Page.IsPostBack) |
| { |
| try |
| { |
| //Get the currently logged in user's Tab-Widgets collection |
| List<Tab> objTabsCollection = GetUserTabsWidgetsCollection(); //Gets the data |
| if (objTabsCollection != null && objTabsCollection.Count > 0) |
| { |
| int tabCounter = 1; |
| //Loop through all the Tabs the user is authorized to view, add the Tabs to the MainTabStrip, |
| //Add PageView to each of the Main tab, Add TabStrip to each of the PageView (Widget level Tabstrip), |
| //Add Widgets to the WindowManager collection to add the association with the widget tabstrip |
| foreach (Tab objEntityMainTab in objTabsCollection) |
| { |
| //If it is the first tab, then make widgets visible, set the tab to the selected tab and |
| //set the PageView of the tab to selected. |
| if (tabCounter++ == 1) |
| { |
| //Add widgets associated with the Main tab |
| AddWidgetsForEachMainTab(objEntityMainTab, true); |
| } |
| else |
| { |
| AddWidgetsForEachMainTab(objEntityMainTab, false); |
| } |
| } |
| } |
| else |
| { |
| Server.Transfer(string.Format("{0}Item=You are not authorized to view any pages in this application.", UnauthorizedPagePath)); |
| } |
| } |
| catch (Exception ex) |
| { |
| //Exception Handling |
| } |
| } |
| } |
| /// <summary> |
| /// Adds the Widgets associated with given Main tab |
| /// </summary> |
| /// <param name="objUIMainTab">Main tab for which the associated widgets need to be added</param> |
| /// <param name="objEntityMainTab">Entity Tab object that consists of the Widgets information for the Main tab</param> |
| /// <param name="isWidgetVisible">Tells if the widgets needs to be visible on initial page load</param> |
| private void AddWidgetsForEachMainTab(Tab objEntityMainTab, bool isWidgetVisible) |
| { |
| short tabIndex = 1; |
| //Create Tab & associated RadWindows for each of the sub tab in the Main tab |
| foreach (Widget objWidget in objEntityMainTab.Widgets) |
| { |
| //Create RadWindow for the Tab |
| RadWindow objTabWindow = new RadWindow(); |
| objTabWindow.ID = objWidget.Widget_Name.ToUpper() + "_WINDOW"; |
| objTabWindow.VisibleOnPageLoad = true; |
| objTabWindow.TabIndex = tabIndex++; |
| objTabWindow.BorderStyle = BorderStyle.None; |
| objTabWindow.Behaviors = WindowBehaviors.Default; |
| objTabWindow.Height = Unit.Pixel(objWidget.Initial_Height); |
| objTabWindow.InitialBehaviors = WindowBehaviors.None; |
| objTabWindow.Left = Unit.Pixel(objWidget.Widget_Left); |
| objTabWindow.ReloadOnShow = true; |
| objTabWindow.Skin = "Telerik"; |
| objTabWindow.Title = objWidget.Widget_Name; |
| objTabWindow.Top = Unit.Pixel(objWidget.Widget_Top); |
| objTabWindow.Width = Unit.Pixel(objWidget.Initial_Width); |
| objTabWindow.IconUrl = "~/images/bg-header-widget.gif"; |
| objTabWindow.NavigateUrl = objWidget.Widget_NavigateURL; |
| objTabWindow.Behaviors = WindowBehaviors.Minimize | WindowBehaviors.Maximize | WindowBehaviors.Move | WindowBehaviors.Reload | WindowBehaviors.Resize; |
| objTabWindow.KeepInScreenBounds = true; |
| objTabWindow.VisibleOnPageLoad = isWidgetVisible; |
| objTabWindow.Visible = true; |
| objTabWindow.VisibleStatusbar = false; |
| //Attributes for the Minimum Height and Width for each of the widgets |
| //along with the value if the widgets needs to be in minimized state while loading |
| objTabWindow.Attributes.Add("isMinimized", objWidget.IsMinimized ? Boolean.FalseString : Boolean.TrueString); |
| objTabWindow.Attributes.Add("MinimunHeight", Convert.ToString(objWidget.Minimum_Height)); |
| objTabWindow.Attributes.Add("MinimunWidth", Convert.ToString(objWidget.Minimum_Width)); |
| //Add the newly created RadWindow to the RadWindowManager |
| DBRadWindowManager.Windows.Add(objTabWindow); |
| } |
| } |
| } |
| //Tab & Widget classes definition |
| public class Tab |
| { |
| public int Tab_Id { get; set; } |
| public string TabName { get; set; } |
| public string CreateID { get; set; } |
| public List<Widget> Widgets { get; set; } |
| } |
| public class Widget |
| { |
| public int Widget_Id {get;set;} |
| public string Widget_Name {get;set;} |
| public string Widget_NavigateURL {get;set;} |
| public bool IsMinimized {get;set;} |
| public int Widget_Left {get;set;} |
| public int Widget_Top {get;set;} |
| public int Initial_Height {get;set;} |
| public int Initial_Width {get;set;} |
| public int Minimum_Width {get;set;} |
| public int Minimum_Height {get;set;} |
| } |
| } |
