or
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="Telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI, Version=2010.3.1317.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4" %> <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="IssuesAndActionsDisplayUserControl.ascx.cs" Inherits="DEP.PMIS.Project.Dashboard.IssuesAndActionsDisplay.IssuesAndActionsDisplayUserControl" %> <Telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"> <asp:Label ID="lblLoading" runat="server">Loading... </asp:Label> </Telerik:RadAjaxLoadingPanel> <!--Added to hide Recently modified Quick launch --><style type="text/css"> .s4-recentchanges {display:none ;} </style> <div class="events-info"> <Telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server"> <AjaxSettings> <Telerik:AjaxSetting AjaxControlID="RadGrid1" > <UpdatedControls> <Telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </Telerik:AjaxSetting> </AjaxSettings> </Telerik:RadAjaxManagerProxy> <Telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"> <Telerik:RadGrid ID="RadGrid1" runat="server" OnPreRender="RadGrid1_PreRender" onitemdatabound="RadGrid1_ItemDataBound" OnDetailTableDataBind="RadGrid1_DetailTableDataBind" GridLines="None" DataMember="Issues" AllowFilteringByColumn="True" AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False" onpdfexporting="RadGrid1_PdfExporting" onitemcommand="RadGrid1_ItemCommand"> <ExportSettings IgnorePaging="true" OpenInNewWindow="true" FileName="Issues_And_Actions" > <Pdf Title="Issues and Actions Report" PageHeight="13in" PageWidth="19in" /> </ExportSettings> <MasterTableView DataKeyNames="Issue ID" HierarchyDefaultExpanded="true" GridLines="None" BorderStyle="Outset" NoMasterRecordsText="No Issues to display" NoDetailRecordsText="No Action Items to display"> <CommandItemSettings ExportToPdfText="Export to Pdf" /> <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"> </RowIndicatorColumn> <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True"> </ExpandCollapseColumn> <Columns> <Telerik:GridHyperLinkColumn AllowFiltering="False" FilterControlAltText="Issue Filter Column" HeaderText="Issue ID" Text="Link" UniqueName="Issue ID" ItemStyle-Width="15%" CurrentFilterFunction="StartsWith" FilterDelay="4000" ShowFilterIcon="false" ItemStyle-BorderStyle="Outset" ItemStyle-BorderWidth="1px"> <ItemStyle Width="15%"/> </Telerik:GridHyperLinkColumn> <Telerik:GridBoundColumn HeaderText="Issue Name" DataField="Issue Name" ItemStyle-Width="15%" CurrentFilterFunction="StartsWith" FilterDelay="4000" ShowFilterIcon="false" ItemStyle-BorderStyle="Outset" ItemStyle-BorderWidth="1px"> <ItemStyle Width="15%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Issue Description" DataField="Issue Description" ItemStyle-Width="30%" CurrentFilterFunction="StartsWith" FilterDelay="4000" ShowFilterIcon="false" ItemStyle-BorderStyle="Outset" ItemStyle-BorderWidth="1px"> <ItemStyle Width="30%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Priority" DataField="Issue Priority" ItemStyle-Width="7%" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith" FilterDelay="4000" ShowFilterIcon="false" ItemStyle-BorderStyle="Outset" ItemStyle-BorderWidth="1px"> <ItemStyle Width="7%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Created" DataField="Issue Created Date" ItemStyle-Width="8%" AutoPostBackOnFilter="true" DataFormatString="{0:d}" CurrentFilterFunction="StartsWith" FilterDelay="4000" ShowFilterIcon="false" ItemStyle-BorderStyle="Outset" ItemStyle-BorderWidth="1px"> <ItemStyle Width="8%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Completed" DataField="Issue Completed Date" ItemStyle-Width="8%" DataFormatString="{0:d}" CurrentFilterFunction="StartsWith" FilterDelay="4000" ShowFilterIcon="false" ItemStyle-BorderStyle="Outset" ItemStyle-BorderWidth="1px"> <ItemStyle Width="8%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Due Date" DataField="Target Resolution Date" ItemStyle-Width="8%" DataFormatString="{0:d}" CurrentFilterFunction="StartsWith" FilterDelay="4000" ShowFilterIcon="false" ItemStyle-BorderStyle="Outset" ItemStyle-BorderWidth="1px"> <ItemStyle Width="8%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Request Status" DataField="Request Status" ItemStyle-Width="9%" CurrentFilterFunction="StartsWith" FilterDelay="4000" ShowFilterIcon="false" ItemStyle-BorderStyle="Outset" ItemStyle-BorderWidth="1px"> <ItemStyle Width="9%" /> </Telerik:GridBoundColumn> </Columns> <DetailTables> <Telerik:GridTableView runat="server" DataKeyNames="Issue ID" DataMember="Actions" Name="Actions" GridLines="Horizontal" PageSize="5" Width="100%" AllowFilteringByColumn="false" NoDetailRecordsText="No Action Items to display" NoMasterRecordsText="No Issues to display" AllowSorting="true"> <CommandItemSettings ExportToPdfText="Export to Pdf" /> <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"> <HeaderStyle Width="20px" /> </RowIndicatorColumn> <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"> <HeaderStyle Width="20px" /> </ExpandCollapseColumn> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"> </EditColumn> </EditFormSettings> <Columns> <Telerik:GridBoundColumn HeaderText="Suggested Action" DataField="Suggested Action" ItemStyle-Width="35%" > <ItemStyle Width="35%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Assigned To" DataField="Assigned To" ItemStyle-Width="8%" > <ItemStyle Width="8%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Action Created Date" DataField="Action Created Date" ItemStyle-Width="8%" > <ItemStyle Width="8%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Completed Date" DataField="Completed Date" ItemStyle-Width="8%" > <ItemStyle Width="8%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Notes" DataField="Resolution Taken" ItemStyle-Width="35%" > <ItemStyle Width="35%" /> </Telerik:GridBoundColumn> <Telerik:GridBoundColumn HeaderText="Request Status" DataField="Request Status" ItemStyle-Width="8%" > <ItemStyle Width="8%" /> </Telerik:GridBoundColumn> </Columns> </Telerik:GridTableView> </DetailTables> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"> </EditColumn> </EditFormSettings> <PagerStyle Mode="NumericPages" /> </MasterTableView> <FilterMenu EnableImageSprites="False"> </FilterMenu> <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"> </HeaderContextMenu> </Telerik:RadGrid> </Telerik:RadAjaxPanel> </div> <div id="buttonPanel"> <asp:Label ID="lblExport" runat="server" Text="Export to PDF: "></asp:Label> <asp:ImageButton ID="btnExportPDF" runat="server" AlternateText="Export to PDF" ImageUrl="~/_layouts/images/DEP.PMIS.Project.Dashboard/pdficon_large.png" onclick="btnExportPDF_Click" /> <br /> </div> <div id="errorPanel"> <br /> <asp:Panel ID="ErrorPanel" runat="server" Visible="true"> <asp:Label ID="lblerror" runat="server" ForeColor="Red"></asp:Label> </asp:Panel> </div> using System; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Configuration; using System.Data; using System.Data.SqlClient; using Microsoft.SharePoint; using Telerik.Web.UI; using DEP.PMIS.Common; using DEP.PMIS.Entityframework; using DEP.PMIS.CPortalWebParts.Code; namespace DEP.PMIS.Project.Dashboard.IssuesAndActionsDisplay { /// <summary> /// The issues and actions web part has a Telerik RadGrid with a Master/Detail table arrangment /// To get the master/detail the DetailTableDataBind bind event is needed. /// (Attempts to use Telerik's automatic capabilities didn't work) /// </summary> public partial class IssuesAndActionsDisplayUserControl : UserControl { IssuesAndActions _IssuesAndActions; private IProjectID _projectInfo; private SPWeb _projectWeb; private bool _shouldDispose; /// <summary> /// Called by the web part when the selected project changes (CPortal) /// </summary> public IProjectID ProjectInfo { set { _projectInfo = value; RadGrid1.Rebind(); } } protected void Page_Load(object sender, EventArgs e) { _IssuesAndActions = new IssuesAndActions(); if (!Page.IsPostBack) { } } protected void RadGrid1_PreRender(object sender, EventArgs e) { if (!Page.IsPostBack) { // Uncomment to expand the first item by default //RadGrid1.MasterTableView.Items[0].Expanded = true; } } /// <summary> /// Called when the detail table is bound to data. Sets the Actions grid's data /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e) { try { OpenWeb(); GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; if (e.DetailTableView.Name == "Actions") { string IssueID = dataItem.GetDataKeyValue("Issue ID").ToString(); e.DetailTableView.DataSource = _IssuesAndActions.Actions(_projectWeb, IssueID); } } catch (Exception ex) { lblerror.Text = "Error binding Actions table: " + ex.Message + ": " + ex.StackTrace; lblerror.Visible = true; } finally { if (_projectWeb != null && _shouldDispose) { _projectWeb.Dispose(); } } } protected void Page_Init(object sender, EventArgs e) { RadGrid1.NeedDataSource += new GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource); } protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { lblerror.Text = ""; try { OpenWeb(); RadGrid1.DataSource = _IssuesAndActions.IssuesActions(_projectWeb); } catch (Exception ex) { lblerror.Text = "Error binding Issues data: " + ex.Message + ": " + ex.StackTrace; lblerror.Visible = true; } finally { if (_projectWeb != null && _shouldDispose) { _projectWeb.Dispose(); } } } /// <summary> /// Called once for each row in the data grid. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { try { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; if (item.DataItem is DataRowView) { DataRowView view = (DataRowView)item.DataItem; // Install the URL for the hyperlink column // (Only do this for the Issues table) if (view.Row.Table.TableName == "Issues") { TableCell cell = ((GridDataItem)e.Item)["Issue ID"]; HyperLink link = (HyperLink)cell.Controls[0]; DataRowView rowView = (DataRowView)e.Item.DataItem; DataRow row = rowView.Row; string url = row["Form URL"].ToString(); string issueID = row["Issue ID"].ToString(); link.NavigateUrl = url; link.Text = issueID; } } } } catch (Exception ex) { lblerror.Text = "Error binding data to Issue row: " + ex.Message + ": " + ex.StackTrace; lblerror.Visible = true; } } protected void btnExportPDF_Click(object sender, ImageClickEventArgs e) { RadGrid1.MasterTableView.HierarchyDefaultExpanded = true; RadGrid1.ExportSettings.FileName = "Issues and Actions for " + SPContext.Current.Web.Name; RadGrid1.MasterTableView.ExportToPdf(); } protected void RadGrid1_PdfExporting(object sender, GridPdfExportingArgs e) { } protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == RadGrid.ExpandCollapseCommandName) { if (e.Item.Expanded == true) e.Item.Expanded = false; else e.Item.Expanded = true; } } /// <summary> /// Opens the SPWeb where the Issues and Actions are found /// This could be the current web or, if the Project Info connecter was set, the /// web will be named there. /// </summary> /// <remarks> /// Note that if we use OpenWeb, we need to dispose of things later on. /// </remarks> private void OpenWeb() { // Look for the project ID in the Project Info (could be set if part is used in CPortal) if (_projectInfo != null) { _projectWeb = SPContext.Current.Site.OpenWeb(_projectInfo.Name); _shouldDispose = true; } else { // Otherwise assume current site is a project site _projectWeb = SPContext.Current.Web; _shouldDispose = false; } } } } $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("SelectedIndexChanged");
How do I get the selected row orderid
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e) { //string[] args = e.Argument.Split('?')[1].Split('!'); GridViewRow row = RadGrid1.Rows[e]; if (e.Argument == "SelectedIndexChanged") { //Label1.Text = (e.Item as GridDataItem)["OrderID"].Text; if (RadGrid1.Items.Count == 0) return;
$telerik.$(document).ready(function () { LoadComboBox1($telerik.findComboBox("RadComboBox1"));});function LoadComboBox1(sender){ var myComboBox = sender; var myComboBoxImage = myComboBox.get_imageDomElement(); //The loading.gif image is in the same directory as the aspx file //This is what is not working properly var myComboBoxImage.src = "loading.gif"; $telerik.$.ajax({ //ajax post done here removed for clarity this code works perfectly });}<telerik:RadComboBox ID="RadComboBox1" runat="server"></telerik:RadComboBox><telerik:RadCodeBlock ID=RadCodeBlock1" runat="server"><script type="text/javascript">//See Javascript Code Block Above</script></telerik:RadCodeBlock>I have a RadGrid configured with Paging and Grouping with Aggregates
- AllowPaging = true
- ShowGroupFooter = true
- RetainGroupFootersVisibility=true
<telerik:GridGroupByExpression> <GroupByFields> <telerik:GridGroupByField FieldName="A" SortOrder="Ascending" HeaderText="A" /> </GroupByFields> </telerik:GridGroupByExpression>I have 1 column defined as Aggregate
<telerik:GridBoundColumn AllowFiltering="False" SortExpression="Amount" DataField="Amount" DataFormatString="{0:C2}" Groupable="False" HeaderText="Amount" ReadOnly="True" Reorderable="False" Resizable="False" UniqueName="Amount" Aggregate="Sum"> </telerik:GridBoundColumn>Problem
The RadGrid, by default, appears to Aggregate for items in the current page (i.e. The Grouping Total that appears in the GroupFooter... only applies to visible items on the currently selected page (even when the group extends into other pages).
Question
How can I implement a custom aggregate in which I sum all of the values for a particular column within a group (across all data items that are in the group / i.e. across all pages)?