Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
64 views
So the workaround for Upload & AJAX is to do a full postback when the appropriate button is clicked.  So I have this upload, the user browses for the file they're uploading and then click submit.  But instead of just doing a full postback, the webpage never fires any server-side events and returns a bunch of nonsense (see: attached image).

I feel like this is an AJAX response?  But it does do a full-postback it seems...and it doesn't seem to fire any of my events...
Calvin
Top achievements
Rank 1
 answered on 08 Jul 2011
4 answers
244 views

I'm trying to write a workaround for the bug in your RadTabStrip control that prevents tabs from being hidden and displayed on demand.

So instead of building the tabstrip with some tabs hidden, I now add only the tab items I want displayed initially, then use javascript to add further tab items later.

Here's a snippet of the js code...

var tabStrip = $find('myTabStrip');
 
var tab = new Telerik.Web.UI.RadTab();
tab.set_text('text');
tab.set_value('pseudo-id_because_ID_field_is_weirdly_not_supported');
 
var attributes = tab.get_attributes();
attributes.setAttribute("onclick", "alert('hello')");
 
tabStrip.get_tabs().insert(1, tab);

this runs ok and adds a tab to the page, but the attribute is never set, and when I look at the page source it has never been rendered. The items rendered using server side code with the same settings work fine.

Is there something else I should be doing, or is this another bug?

John
Top achievements
Rank 1
 answered on 08 Jul 2011
1 answer
148 views
Hi,
I am not able to find the all day Checkbox Value in  AppointmentInsert Event And also The CustomAttribute textbox also not able to find. Please Help me on this.
Plamen
Telerik team
 answered on 08 Jul 2011
1 answer
110 views
Hi,

I wonder how I can resolve the following issue.

I have tab strip set with attributes:
PerTabScrolling="false"
ScrollChildren="true"
ScrollButtonsPosition="Right"
OnClientLoad="rtsAutoSelectFirstTab"
OnClientTabSelecting="rtsTabSelecting"

        function rtsAutoSelectFirstTab()
        {
            var rts = $find("<%=rts.ClientID%>");
            rts.get_tabs().getTab(0).scrollIntoView();
        }

        function rtsTabSelecting(sender, args)
       {
            //scroll intto visible area selected tab
            args.get_tab().scrollIntoView();
       }


each Tab in a strip has "close tab" image, which removes tab on click. Tab removal is organized on server side and tab strip is getting rebuilt, with 1st tab auto selected.

While all tabs are visible w/o scrolling, no issues are there, however, after I add enough tabs, scroll to the right and start removing them one by one, at some point scroll bar disappears and the leftmost tab disapears from the view or being shown only as a part. Despite having rtsTabSelecting, this leftmost tab is not shown as it should.

any help would be appreciated!

Thanks!
Kate
Telerik team
 answered on 08 Jul 2011
5 answers
136 views
Hi All,

I'm binding my grid with the client-side api.  My data gets populated but by default displays with my ID field in ASC order.  I'd like change this and have it appear in DESC order.  I cannot change the query from the datasource.  I've tried playing around with the mastertableview's fireCommand "sort" but it creates an undesired postback.  There must be a way to do sort on a field right after the initial load.

Thx in advance. 
Tsvetina
Telerik team
 answered on 08 Jul 2011
1 answer
136 views
I have RadGrid inside of the user control which has ViewState turned off. Everything runs fine, including default paging. The problem is that I cannot make custom paging to work because if grid has AllowCustomPaging=true then CurrentPageIndex is always 0 since the container has view state disabled. The grid itself has EnableViewState="true" but it appears that it stores CurrentPageIndex elsewhere.

There is OnPageIndexChanged event which does fire and gives me the next page index, but I cannot use it to store index in the session because this event fires AFTER OnNeedDataSource. I wish there was OnPageIndexChanging event..

How can I make it to work?

-Stan
Tsvetina
Telerik team
 answered on 08 Jul 2011
1 answer
62 views
Hi,
I am trying to localize the contents of the Grid Pager and this is the code i have in the Item Data Bound event handler

if (e.Item is GridPagerItem) //set the appropriate values in the Pager drop down
{
                    GridPagerItem gridPagerItem= e.Item as GridPagerItem;
  
                    Label pageSizeLabel = gridPagerItem.FindControl("ChangePageSizeLabel") as Label;
                    if (null != pageSizeLabel)
                        pageSizeLabel.Text = "Number of Items:";
  
                    GridUsersList.PagerStyle.PagerTextFormat = "{4}{5} " + "items in " + "{1}" + " pages";
                    GridUsersList.PagerStyle.NextPageToolTip = "Next Page";
                    GridUsersList.PagerStyle.PrevPageToolTip = "Previous Page";
                    GridUsersList.PagerStyle.LastPageToolTip = "Last Page";
                    GridUsersList.PagerStyle.FirstPageToolTip = "First Page";
}

This works fine, but i have over 20 grids in different web pages in my application. Is there any way to standardize this instead of making this change in 20 different places?

Ullas
Mira
Telerik team
 answered on 08 Jul 2011
1 answer
319 views
I have a web user control that allows the user to run one of several available canned reports from a rad combo box.  I'm able to specify which report to run and specify a few basic criteria when producing the first report.  Afterwards, however, if I select a different report (which programmatically generates the columns in a rad grid and selects the appropriate data source) after returning to the criteria screen I receive this error:

Error: Sys.WebForms.PageRequestManagerServerErrorException: There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource.

After further investigation, it seems as if the DataKeyValues the grid is expecting "lags" behind because I can keep running the same report with different criteria so long as the report type remains the same.  As soon as I change report types (which use differnet DataKeyValues), the grid does not appear to update with those values (still uses the DataKeyValues from the previous report) and fails.  I'm hoping someone else can shed some light on the situation.  I've provided my interface and server-side code below.

User Control Interface:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ReportManager.ascx.cs" Inherits="AZ.SA.RL.App.ProgramManagement.Controls.ReportManager" %>
 
<telerik:RadCodeBlock ID="ControlScripts" runat="server">
<script type="text/javascript">
    function onRequestStart(sender, args) {
        if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
            args.set_enableAjax(false);
        }
    }
</script>
</telerik:RadCodeBlock>
 
<telerik:RadAjaxManager ID="Report_ScriptManager" runat="server">
    <ClientEvents OnRequestStart="onRequestStart" />
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="Result_Grid">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Result_Grid" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadAjaxPanel ID="ControlContainer_AjaxPanel" runat="server" CssClass="ContentBlock" Style="width:auto">
    <h3><asp:Label ID="ControlHeader_Label" runat="server" Text="Quick Report" /></h3>
    <asp:ValidationSummary ID="QuickReport_ValidationSummary"
            runat="server"
            ShowMessageBox="false"
            ShowSummary="true"
            ValidationGroup="QuickReportValidation" />        
    <asp:Panel ID="QuickReport_Panel" runat="server" Visible="true">       
        <ul>
            <li>
                <asp:Label ID="QuickReportType_Label" runat="server" AssociatedControlID="QuickReportType_Combobox" Text="Quick Report" />
                <telerik:RadComboBox ID="QuickReportType_Combobox" runat="server" />
            </li>
        </ul>
        <ul>
            <li>
                <asp:Label ID="StartDate_Label" runat="server" AssociatedControlID="QuickReportStartDate_DatePicker" Text="Start Date" />
                <telerik:RadDatePicker ID="QuickReportStartDate_DatePicker" runat="server">
                    <ShowAnimation Type="Fade" Duration="500" />
                    <HideAnimation Type="Fade" Duration="500" />
                </telerik:RadDatePicker>
                <asp:RequiredFieldValidator ID="QuickReportStartDate_RequiredField"
                    runat="server"
                    ControlToValidate="QuickReportStartDate_DatePicker"
                    CssClass="Validator"
                    Display="Dynamic"
                    ErrorMessage="Please specify a start date in the Start Date field."                                
                    SetFocusOnError="true"
                    Text="*"
                    ValidationGroup="QuickReportValidation" />
                <asp:CompareValidator ID="QuickReportStartDate_StartDateBeforeEndDate"
                    runat="server"
                    ControlToValidate="QuickReportStartDate_DatePicker"
                    ControlToCompare="QuickReportEndDate_DatePicker"
                    CssClass="Validator"
                    Display="Dynamic"
                    ErrorMessage="The start date of a report must come before its end date."
                    Operator="LessThanEqual"
                    SetFocusOnError="true"
                    Text="*"
                    Type="Date"
                    ValidationGroup="QuickReportValidation" />                   
            </li>
        </ul>
        <ul>
            <li>
                <asp:Label ID="EndDate_Label" runat="server" AssociatedControlID="QuickReportEndDate_DatePicker" Text="End Date" />
                <telerik:RadDatePicker ID="QuickReportEndDate_DatePicker" runat="server">
                    <ShowAnimation Type="Fade" Duration="500" />
                    <HideAnimation Type="Fade" Duration="500" />
                </telerik:RadDatePicker>
                <asp:RequiredFieldValidator ID="QuickReportEndDate_RequiredField"
                    runat="server"
                    ControlToValidate="QuickReportEndDate_DatePicker"
                    CssClass="Validator"
                    Display="Dynamic"
                    ErrorMessage="Please specify an end date in the Start Date field."                                
                    SetFocusOnError="true"
                    Text="*"
                    ValidationGroup="QuickReportValidation" />
            </li>
        </ul>
        <ul>
            <li>
                <asp:Label ID="Options_Label" runat="server" AssociatedControlID="QuickReportIncludeQuickReport_CheckBoxList" Text="Options" />
                <div class="CheckBoxList">
                    <asp:CheckBoxList ID="QuickReportIncludeQuickReport_CheckBoxList"
                        runat="server"
                        RepeatLayout="UnorderedList">
                        <asp:ListItem Text="Include Quick Plans" Value="0" />
                    </asp:CheckBoxList>
                </div>        
            </li>
        </ul>                               
        <asp:Button ID="RunReport_Button"
            runat="server"
            CausesValidation="true"
            OnClick="RunReport_Button_Click"
            Text="Run Report"            
            ValidationGroup="QuickReportValidation" />
    </asp:Panel>
 
    <asp:Panel ID="CustomReport_Panel" runat="server">   
    </asp:Panel>
 
    <asp:Panel ID="Result_Panel" runat="server" Visible="false">       
        <telerik:RadGrid ID="Result_Grid"
            runat="server"
            ExportSettings-ExportOnlyData="true"
            ExportSettings-OpenInNewWindow="true"
            ExportSettings-IgnorePaging = "true"
            ExportSettings-HideStructureColumns="true"                                                
            OnNeedDataSource="Result_Grid_NeedDataSource"
            OnDetailTableDataBind="Result_Grid_DetailTableDataBind"
            OnGridExporting="Result_Grid_GridExporting"
            OnItemDataBound="Result_Grid_ItemDataBound"                     
            Skin="Black">
            <MasterTableView
                AllowPaging="true"
                AutoGenerateColumns="false"               
                CommandItemDisplay = "Top"
                CommandItemSettings-ShowExportToCsvButton="false"
                CommandItemSettings-ShowExportToExcelButton="true"
                CommandItemSettings-ShowExportToPdfButton="false"
                CommandItemSettings-ShowExportToWordButton="true"
                CommandItemSettings-ShowAddNewRecordButton="false"
                GroupLoadMode="Server"
                Name="ReportResults"                
                HierarchyDefaultExpanded="true"
                HierarchyLoadMode="ServerBind"               
                PagerStyle-AlwaysVisible="true"
                PagerStyle-Mode="NextPrevNumericAndAdvanced"
                PagerStyle-Position="Top"
                PageSize="30"               
                TableLayout="Fixed">
                <DetailTables>
                    <telerik:GridTableView 
                        AutoGenerateColumns="true"                   
                        Name="DetailResults"
                        OnDataBound="Result_DetailGrid_OnDataBound"
                        OnPreRender="Result_DetailGrid_PreRender"
                        BorderStyle="None"                       
                        ShowHeader="false"
                        TableLayout="Fixed">                       
                    </telerik:GridTableView>                   
                </DetailTables>                                
            </MasterTableView>
        </telerik:RadGrid>
    </asp:Panel>   
</telerik:RadAjaxPanel>

Page Interface:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ReportView.ascx.cs" Inherits="AZ.SA.RL.App.ProgramManagement.ReportView" %>
<%@ Register Src="~/Controls/ReportManager.ascx" TagName="ReportManager" TagPrefix="pm"  %>
 
<telerik:RadAjaxManagerProxy ID="Program_AjaxManager" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="Report_Toolbar_ButtonClick">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="Report_ReportManager" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
 
<asp:UpdatePanel ID="Toolbar_AjaxPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
    <telerik:RadToolBar ID="Report_Toolbar"
        runat="server"
        Skin="Black"
        BorderStyle="None"
        BorderWidth="0"
        OnButtonClick="Report_Toolbar_ButtonClick"
        Width="100%">
        <Items>           
            <telerik:RadToolBarDropDown Text="New Report" DropDownWidth="150px">
                <Buttons>
                    <telerik:RadToolBarButton Text="Quick Report" CommandName="NEW" Value="Quick" />
                    <telerik:RadToolBarButton Text="Custom Report" CommandName="NEW" Value="Custom" Enabled="false" Visible="false" />
                </Buttons>
            </telerik:RadToolBarDropDown>
            <telerik:RadToolBarButton IsSeparator="true" Value="Sep1" />
            <telerik:RadToolBarButton Text="Criteria" CommandName="CRITERIA" Checked="true" CheckOnClick="true" Group="PlanType" />
            <telerik:RadToolBarButton Text="Results" CommandName="RESULTS" Checked="false" CheckOnClick="true" Group="PlanType" />           
        </Items>   
    </telerik:RadToolBar>
</ContentTemplate>
</asp:UpdatePanel>
 
<asp:UpdatePanel ID="Content_AjaxPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
    <div class="ContentContainer">
        <pm:ReportManager ID="Report_ReportManager" runat="server" />
    </div>
</ContentTemplate>
</asp:UpdatePanel>

User Control Code-Behind
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;
using AZ.SA.RL.App.ProgramManagement.Objects;
using System.ComponentModel;
 
namespace AZ.SA.RL.App.ProgramManagement.Controls
{
    public partial class ReportManager : System.Web.UI.UserControl
    {
        //Enumerators
        #region Enumerators
        public enum QuickReportType
        {
            ByProgrammingCenter = 0,
            ByPrimaryOrganizer = 1,
            ByOutcomes = 2
        }
 
        public enum OpMode
        {
            Quick = 0,
            Custom = 1
        }
 
        public enum DispMode
        {
            Criteria = 0,
            Results = 1
        }
        #endregion
 
        //Properties
        #region Properties
        /// <summary>
        /// Gets or sets the current quick report being run by the manager.
        /// </summary>
        [Browsable(true),
        Category("Function"),
        DefaultValue(QuickReportType.ByProgrammingCenter)]
        public QuickReportType QuickReport
        {
            get
            {
                QuickReportType result = QuickReportType.ByProgrammingCenter;
                if (ViewState["__QUICKREPORT"] != null)
                {
                    result = (QuickReportType)ViewState["__QUICKREPORT"];
                }
 
                return result;
            }
 
            set
            {
                ViewState["__QUICKREPORT"] = value;
            }
        }
         
        /// <summary>
        /// Gets or sets the current operation mode of the manager.
        /// </summary>
        [Browsable(true),
        Category("Function"),
        DefaultValue(OpMode.Quick)]
        public OpMode OperationMode
        {
            get
            {
                OpMode result = OpMode.Quick;
                if (ViewState["__OPERATIONMODE"] != null)
                {
                    result = (OpMode)ViewState["__OPERATIONMODE"];
                }
 
                return result;
            }
 
            set
            {
                ViewState["__OPERATIONMODE"] = value;
            }
        }
 
        /// <summary>
        /// Gets or sets the current display mode of the manager.
        /// </summary>
        [Browsable(true),
        Category("Function"),
        DefaultValue(DispMode.Criteria)]
        public DispMode DisplayMode
        {
            get
            {
                DispMode result = DispMode.Criteria;
                if (ViewState["__DISPLAYMODE"] != null)
                {
                    result = (DispMode)ViewState["__DISPLAYMODE"];
                }
 
                return result;
            }
 
            set
            {
                ViewState["__DISPLAYMODE"] = value;
                //ControlContainer_AjaxPanel.RaisePostBackEvent("__DISPLAYMODECHANGED");
            }
        }
 
        /// <summary>
        /// Sets the title for the manager
        /// </summary>
        [Browsable(true),
        Category("Data"),
        DefaultValue("No Title")]
        public string Title
        {
            private get
            {
                string result = "No Title";
                if (ViewState["__TITLE"] != null)
                {
                    result = (string)ViewState["__TITLE"];
                }
 
                return result;
            }
 
            set
            {
                ViewState["__TITLE"] = value;
            }
        }
 
        /// <summary>
        /// Stores the start datetime for quick report filter
        /// </summary>
        [Browsable(false),
        Category("Data"),
        DefaultValue(null)]
        private DateTime ReportStartDate
        {
            get
            {
                DateTime result = default(DateTime);
                if (ViewState["__STARTDATE"] != null)
                {
                    result = (DateTime)ViewState["__STARTDATE"];
                }
 
                return result;
            }
 
            set
            {
                ViewState["__STARTDATE"] = value;
            }
        }
 
        /// <summary>
        /// Stores the end datetime for quick report filter
        /// </summary>
        [Browsable(false),
        Category("Data"),
        DefaultValue(null)]
        private DateTime ReportEndDate
        {
            get
            {
                DateTime result = default(DateTime);
                if (ViewState["__ENDDATE"] != null)
                {
                    result = (DateTime)ViewState["__ENDDATE"];
                }
 
                return result;
            }
 
            set
            {
                ViewState["__ENDDATE"] = value;
            }
        }
        #endregion
 
        //Methods - Custom
        #region Methods - Custom
        protected void RenderView()
        {
            Label controlHeader = ControlHeader_Label;
            Panel quickReportPanel = QuickReport_Panel;
            Panel customReportPanel = CustomReport_Panel;
            Panel resultPanel = Result_Panel;
 
            switch (DisplayMode)
            {
                case DispMode.Criteria:
                    resultPanel.Visible = false;
 
                    if (OperationMode == OpMode.Quick)
                    {
                        quickReportPanel.Visible = true;
                        customReportPanel.Visible = false;
                    }
                    else if (OperationMode == OpMode.Custom)
                    {
                        quickReportPanel.Visible = false;
                        customReportPanel.Visible = true;
                    }
                    break;
 
                case DispMode.Results:
 
                    if (OperationMode == OpMode.Quick)
                    {
                        resultPanel.Visible = true;
                        quickReportPanel.Visible = false;
                        customReportPanel.Visible = false;
                    }
                    else if (OperationMode == OpMode.Custom)
                    {
 
                    }
                    break;
            }
 
            if (DisplayMode == DispMode.Criteria)
            {
                if (OperationMode == OpMode.Custom)
                {
                    Title = "Custom Report Criteria";
                }
                else
                {
                    Title = "Quick Report Criteria";
                }
            }
 
            //Modify the header to show the current report
            controlHeader.Text = Title;
        }
 
        protected void PopulateQuickReports(object sender)
        { 
            RadComboBox quickReportList = (RadComboBox)sender;
                         
            foreach (QuickReportType quickReportEnum in Enum.GetValues(typeof(QuickReportType)))
            {
                int value = (int)Enum.Parse(typeof(QuickReportType), quickReportEnum.ToString());
 
                RadComboBoxItem reportItem = new RadComboBoxItem(quickReportEnum.ToString(), value.ToString());
                quickReportList.Items.Add(reportItem);
 
                QuickReportType itemValue = (QuickReportType)value;
 
                switch (itemValue)
                {
                    case QuickReportType.ByProgrammingCenter:
                        reportItem.Text = "By Programming Center";
                        break;
 
                    case QuickReportType.ByPrimaryOrganizer:
                        reportItem.Text = "By Primary Organizer";
                        break;
 
                    case QuickReportType.ByOutcomes:
                        reportItem.Text = "By Primary Goal";
                        break;
                }
            }
        }
 
        protected void RenderReportGrid(object sender, QuickReportType reportType)
        {
            RadGrid reportGrid = (RadGrid)sender;           
            GridBoundColumn boundColumn = null;
 
            reportGrid.MasterTableView.AutoGenerateColumns = false;
            reportGrid.MasterTableView.TableLayout = GridTableLayout.Fixed;
            reportGrid.Columns.Clear();
 
            switch (reportType)
            {
                case QuickReportType.ByProgrammingCenter:
 
                    Title = "Quick Report - Programs by Programming Center (" + ReportStartDate.ToShortDateString() + " - " + ReportEndDate.ToShortDateString() + ")";
                    reportGrid.MasterTableView.ClientDataKeyNames = new string[] { "DepartmentUnitId" };
 
                    if (reportGrid.Columns.Count <= 0)
                    {
                        //Add the Program Name column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "UnitName";
                        boundColumn.HeaderText = "Programming Center";
                        boundColumn.UniqueName = "UnitName";
 
                        //Add the Program Name column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "UnitShortName";
                        boundColumn.HeaderText = "Unit Short NAme";
                        boundColumn.UniqueName = "UnitShortName";
                        boundColumn.Visible = false;
 
                        //Add the Program Name column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "DepartmentUnitId";
                        boundColumn.HeaderText = "DepartmentUnitId";
                        boundColumn.UniqueName = "DepartmentUnitId";
                        boundColumn.Visible = false;
 
                        //Add the Program Count column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "ProgramCount";
                        boundColumn.HeaderText = "ProgramCount";
                        boundColumn.UniqueName = "ProgramCount";
                        boundColumn.Visible = false;
                    }
                    break;
 
                case QuickReportType.ByPrimaryOrganizer:
 
                    Title = "Quick Report - Programs by Primary Organizer (" + ReportStartDate.ToShortDateString() + " - " + ReportEndDate.ToShortDateString() + ")";
                    reportGrid.MasterTableView.DataKeyNames = new string[] {"PrimaryOrganizerName","GroupId"};
 
                    if (reportGrid.Columns.Count <= 0)
                    {
                        //Add the Program Name column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "PrimaryOrganizerName";
                        boundColumn.HeaderText = "Primary Organizer";
                        boundColumn.UniqueName = "PrimaryOrganizerName";
 
                        //Add the Program Name column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "GroupName";
                        boundColumn.HeaderText = "Group Name";
                        boundColumn.UniqueName = "GroupName";
                        boundColumn.Visible = false;
 
                        //Add the Program Name column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "GroupId";
                        boundColumn.HeaderText = "GroupId";
                        boundColumn.UniqueName = "GroupId";
                        boundColumn.Visible = false;
 
                        //Add the Program Count column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "ProgramCount";
                        boundColumn.HeaderText = "ProgramCount";
                        boundColumn.UniqueName = "ProgramCount";
                        boundColumn.Visible = false;
                    }
                    break;
 
                case QuickReportType.ByOutcomes:
 
                    Title = "Quick Report - Programs by Primary Goal (" + ReportStartDate.ToShortDateString() + " - " + ReportEndDate.ToShortDateString() + ")";
                    reportGrid.MasterTableView.DataKeyNames = new string[] { "BaseOutcomeId" };                   
 
                    if (reportGrid.Columns.Count <= 0)
                    {
                        //Add the Program Name column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "PrimaryGoalName";
                        boundColumn.HeaderText = "Primary Goal";
                        boundColumn.UniqueName = "PrimaryGoalName";
 
                        //Add the Base Outcome Id column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "BaseOutcomeId";
                        boundColumn.HeaderText = "BaseOutcomeId";
                        boundColumn.UniqueName = "BaseOutcomeId";
                        boundColumn.Visible = false;                       
 
                        //Add the Program Count column
                        boundColumn = new GridBoundColumn();
                        reportGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "ProgramCount";
                        boundColumn.HeaderText = "ProgramCount";
                        boundColumn.UniqueName = "ProgramCount";
                        boundColumn.Visible = false;
                    }
                    break;
            }
             
            //Set the export file name to the title
            reportGrid.ExportSettings.FileName = Title;
        }
 
        protected void RenderDetailGrid(object sender, QuickReportType reportType)
        {
            //RadGrid reportGrid = (RadGrid)sender;                       
            //GridTableView detailGrid = reportGrid.MasterTableView.DetailTables[0];
 
            GridTableView detailGrid = (GridTableView)sender;           
            GridBoundColumn boundColumn = null;
            GridDateTimeColumn dateColumn = null;
 
            detailGrid.AutoGenerateColumns = false;
            detailGrid.TableLayout = GridTableLayout.Fixed;
 
            switch (reportType)
            {
                case QuickReportType.ByProgrammingCenter:
                     
                     
                    break;
 
                case QuickReportType.ByPrimaryOrganizer:
 
                    if (detailGrid.Columns.Count <= 0)
                    {
                        //Add the Program Name column
                        boundColumn = new GridBoundColumn();
                        detailGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "ProgramName";
                        boundColumn.HeaderText = "Program Name";
                        boundColumn.UniqueName = "ProgramName";                      
                        //boundColumn.HeaderStyle.Width = Unit.Percentage(30);
                        //boundColumn.ItemStyle.Width = Unit.Percentage(30);
 
                        //Add the Primary Goal column
                        boundColumn = new GridBoundColumn();
                        detailGrid.Columns.Add(boundColumn);
                        boundColumn.DataField = "PrimaryGoalName";
                        boundColumn.HeaderText = "Primary Goal";
                        boundColumn.UniqueName = "PrimaryGoalName";
                        //boundColumn.HeaderStyle.Width = Unit.Percentage(30);
                        //boundColumn.ItemStyle.Width = Unit.Percentage(30);
 
                        //Add the Start Date column                   
                        dateColumn = new GridDateTimeColumn();
                        detailGrid.Columns.Add(dateColumn);
                        dateColumn.DataField = "StartDate";
                        dateColumn.HeaderText = "Start Date";
                        dateColumn.UniqueName = "StartDate";
                        //dateColumn.HeaderStyle.Width = Unit.Percentage(20);
                        //dateColumn.ItemStyle.Width = Unit.Percentage(20);
 
                        //Add the End Date column                   
                        dateColumn = new GridDateTimeColumn();
                        detailGrid.Columns.Add(dateColumn);
                        dateColumn.DataField = "EndDate";
                        dateColumn.HeaderText = "End Date";
                        dateColumn.UniqueName = "EndDate";
                        //dateColumn.HeaderStyle.Width = Unit.Percentage(20);
                        //dateColumn.ItemStyle.Width = Unit.Percentage(20);
                    }
                    break;
                case QuickReportType.ByOutcomes:
 
                    break;
            }
        }
        #endregion
 
        //Methods - Event Handling
        #region Methods - Event Handling                      
        protected void Page_PreRender(object sender, EventArgs e)
        {           
            RadComboBox quickReportList = QuickReportType_Combobox;
 
            if (quickReportList.Items.Count <= 0)
            {
                PopulateQuickReports(quickReportList);
            }
 
            RenderView();
        }
 
        protected void RunReport_Button_Click(object sender, EventArgs e)
        {
            Page.Validate("QuickReportValidation");
 
            if (Page.IsValid)
            {
                RadComboBox quickReportTypeList = QuickReportType_Combobox;
                RadDatePicker startDatePicker = QuickReportStartDate_DatePicker;
                RadDatePicker endDatePicker = QuickReportEndDate_DatePicker;
 
                DateTime startDate = default(DateTime);
                DateTime endDate = default(DateTime);
 
                QuickReportType quickReportType = (QuickReportType)int.Parse(quickReportTypeList.SelectedValue);
 
                if (startDatePicker.SelectedDate.HasValue)
                    startDate = startDatePicker.SelectedDate.Value;
 
                if (endDatePicker.SelectedDate.HasValue)
                    endDate = endDatePicker.SelectedDate.Value;
 
                //Set the quick report type
                QuickReport = quickReportType;
                OperationMode = OpMode.Quick;
                DisplayMode = DispMode.Results;
 
                ReportStartDate = startDate;
                ReportEndDate = endDate;
 
                Result_Grid.Rebind();
            }
        }
 
        protected void Result_Grid_GridExporting(object sender, GridExportingArgs e)
        {
            RadGrid reportGrid = (RadGrid)sender;
 
            switch (e.ExportType)
            {
                case ExportType.Excel:
                    reportGrid.MasterTableView.ExpandCollapseColumn.Visible = false;
                    //reportGrid.MasterTableView.Columns.RemoveAt(0);
                    //reportGrid.MasterTableView.Columns.RemoveAt(0);
                 
                    //reportGrid.MasterTableView.Visible = false;
                    break;
            }
        }
 
        protected void Result_Grid_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            RadGrid reportGrid = (RadGrid)sender;
             
            if (!e.IsFromDetailTable)
            {
                switch (QuickReport)
                {
                    case QuickReportType.ByProgrammingCenter:
 
                        reportGrid.DataSource = Report.ProgrammingCenters(ReportStartDate, ReportEndDate, true);
                        RenderReportGrid(reportGrid, QuickReport);
                        break;
 
                    case QuickReportType.ByPrimaryOrganizer:
 
                        reportGrid.DataSource = Report.PrimaryOrganinizers(ReportStartDate, ReportEndDate, true);
                        RenderReportGrid(reportGrid, QuickReport);
                        break;
 
                    case QuickReportType.ByOutcomes:
 
                        reportGrid.DataSource = Report.Outcomes(ReportStartDate, ReportEndDate, true);
                        RenderReportGrid(reportGrid, QuickReport);
                        break;
                }               
            }
        }
 
        protected void Result_Grid_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
        {
            RadGrid reportGrid = (RadGrid)sender;
            GridTableView detailGrid = (GridTableView)e.DetailTableView;
 
            //RenderDetailGrid(detailGrid, QuickReport);
 
            GridDataItem dataItem = detailGrid.ParentItem;
 
            switch (QuickReport)
            {
                case QuickReportType.ByProgrammingCenter:
 
                    int departmentUnitId = (int)dataItem.GetDataKeyValue("DepartmentUnitId");
 
                    detailGrid.DataSource = Report.ProgramsByProgrammingCenter(departmentUnitId, ReportStartDate, ReportEndDate);
                    break;
 
                case QuickReportType.ByPrimaryOrganizer:
                                
                    string primaryOrganizerName = dataItem.GetDataKeyValue("PrimaryOrganizerName").ToString();
                    int groupId = (int)dataItem.GetDataKeyValue("GroupId");
 
                    detailGrid.DataSource = Report.ProgramsByPrimaryOrganizer(primaryOrganizerName, groupId, ReportStartDate, ReportEndDate);
                    break;
 
                case QuickReportType.ByOutcomes:
 
                    int baseOutcomeId = (int)dataItem.GetDataKeyValue("BaseOutcomeId");
 
                    detailGrid.DataSource = Report.ProgramsByPrimaryOutcome(baseOutcomeId, ReportStartDate, ReportEndDate);
                    break;
            }           
        }
 
        protected void Result_Grid_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                if (e.Item.OwnerTableView.Name == "ReportResults")
                {
                    GridDataItem gridDataItem = (GridDataItem)e.Item;
                    int programCount = 0;
 
                    switch (QuickReport)
                    {
                        case QuickReportType.ByProgrammingCenter:
 
                            string unitName = gridDataItem["UnitName"].Text;
                            programCount = int.Parse(gridDataItem["ProgramCount"].Text);
                             
                            if(programCount == 1)
                                gridDataItem["UnitName"].Text = (unitName + " (" + programCount.ToString() + " Program)").ToUpper();
                            else
                                gridDataItem["UnitName"].Text = (unitName + " (" + programCount.ToString() + " Programs)").ToUpper();
 
                            gridDataItem["UnitName"].Font.Bold = true;
                            gridDataItem["UnitName"].HorizontalAlign = HorizontalAlign.Left;
                            break;
 
                        case QuickReportType.ByPrimaryOrganizer:
                             
                            string organizerName = gridDataItem["PrimaryOrganizerName"].Text.ToString();
                            string groupName = gridDataItem["GroupName"].Text.ToString();
                            programCount = int.Parse(gridDataItem["ProgramCount"].Text);
 
                            if (programCount == 1)
                                gridDataItem["PrimaryOrganizerName"].Text = (groupName + " - " + organizerName + " (" + programCount.ToString() + " Program)").ToUpper();
                            else
                                gridDataItem["PrimaryOrganizerName"].Text = (groupName + " - " + organizerName + " (" + programCount.ToString() + " Programs)").ToUpper();
 
                            gridDataItem["PrimaryOrganizerName"].Font.Bold = true;
                            gridDataItem["PrimaryOrganizerName"].HorizontalAlign = HorizontalAlign.Left;
                            break;
 
                        case QuickReportType.ByOutcomes:
 
                            string outcomeName = gridDataItem["PrimaryGoalName"].Text;
                            programCount = int.Parse(gridDataItem["ProgramCount"].Text);
                             
                            if(programCount == 1)
                                gridDataItem["PrimaryGoalName"].Text = (outcomeName + " (" + programCount.ToString() + " Program)").ToUpper();
                            else
                                gridDataItem["PrimaryGoalName"].Text = (outcomeName + " (" + programCount.ToString() + " Programs)").ToUpper();
 
                            gridDataItem["PrimaryGoalName"].Font.Bold = true;
                            gridDataItem["PrimaryGoalName"].HorizontalAlign = HorizontalAlign.Left;                           
                            break;
                    }                   
                }               
            }
        }
        #endregion
    }
}

Page Code-Behind
using System;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
 
namespace AZ.SA.RL.App.ProgramManagement
{
    public partial class ReportView : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void Report_Toolbar_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
        {
            //Get clicked button information           
            RadToolBarButton button = (RadToolBarButton)e.Item;
            string command = button.CommandName;
            string value = button.Value;
 
            //Determine which action to take based on the command passed by the clicked toolbar button
            switch (command)
            {
                case "NEW":
 
                    if (value == "Custom")
                    {
                        Report_ReportManager.DisplayMode = ProgramManagement.Controls.ReportManager.DispMode.Criteria;
                        Report_ReportManager.OperationMode = ProgramManagement.Controls.ReportManager.OpMode.Custom;
                    }
                    else
                    {
                        Report_ReportManager.DisplayMode = ProgramManagement.Controls.ReportManager.DispMode.Criteria;
                        Report_ReportManager.OperationMode = ProgramManagement.Controls.ReportManager.OpMode.Quick;
                    }
                    break;
            }
 
            //Update the program content ajax panel
            Content_AjaxPanel.Update();
        }
    }
}

Thanks in advance.
Tsvetina
Telerik team
 answered on 08 Jul 2011
3 answers
93 views
Hi,

I have integrated CKEditor with popup spell checker but when I use more content with tables and list tag, the checker does not scroll well. It does not scroll the content in table if there is any misspell. Please see attachment where popup does not show the "Linux" in textarea but suggest spell for this. This will make user confuse.

Could you please provide any solution for this, I am looking forward for your reply.

Thanks,
Tarun
Tarun
Top achievements
Rank 1
 answered on 08 Jul 2011
3 answers
60 views
Hello folks.

I don't know why, but, when I'm working with telerik radcontrols, I can't see the default icons, like in grid. See my picture below:

http://img90.imageshack.us/img90/8595/noiconsf.png

If you look, the icons of "Add new record" and "Refresh" doesn't appear.

What's wrong? I need to do some more adjusts in my VS?

Regards.
Vasil
Telerik team
 answered on 08 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?