Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
118 views
Heeey guys 

i have a quest what do i do wrong that there is no data to be displayed ? 


<%@ Page Title="" Language="C#" MasterPageFile="~/ABBMaster.Master" AutoEventWireup="true" CodeBehind="YearMonthReport.aspx.cs" Inherits="HolidayTracker.Testing.YearMonthReaport" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="MainRegionContentPlaceHolder" runat="server">
    <link rel="Stylesheet" type="text/css" href="ReportStyle.css" />
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1"></telerik:RadScriptManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" 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);
                }
            }
            function getOuterHTML(obj) {
                if (typeof (obj.outerHTML) == "undefined") {
                    var divWrapper = document.createElement("div");
                    var copyOb = obj.cloneNode(true);
                    divWrapper.appendChild(copyOb);
                    return divWrapper.innerHTML
                }
                else
                    return obj.outerHTML;
            }
 
 
 
 
            function PrintRadGrid() {
                {
                    var previewWnd = window.open('about:blank', '', '', false);
                    var sh = '<%= ClientScript.GetWebResourceUrl(UserGrid.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",UserGrid.Skin)) %>';
                    var shBase = '<%= ClientScript.GetWebResourceUrl(UserGrid.GetType(),"Telerik.Web.UI.Skins.Grid.css") %>';
                    var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link>";
                    styleStr += "<link href = '" + shBase + "' rel='stylesheet' type='text/css'></link></head>";
                    var htmlcontent = styleStr + "<body>" + getOuterHTML($find('<%= UserGrid.ClientID %>').get_element()) + "</body></html>";
                    previewWnd.document.open();
                    previewWnd.document.write(htmlcontent);
                    previewWnd.document.close();
                    previewWnd.print();
 
                    if (!$telerik.isChrome) {
                        previewWnd.close();
                    }
                }
            }
 
        </script>
    </telerik:RadCodeBlock>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <ClientEvents OnRequestStart="onRequestStart" />
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="UserGrid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="UserGrid" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxPanel runat="server" Height="600px" ID="RadAjaxPanel1">
        <div class="qsf-demo-canvas">
            <div class="Year" runat="server">
                <telerik:RadComboBox ID="rcbYear" runat="server" Visible="false" Width="186px" Label="Year: " AutoPostBack="true" OnSelectedIndexChanged="rcbYear_SelectedIndexChanged">
                </telerik:RadComboBox>
            </div>
            <div class="Month">
                <telerik:RadComboBox ID="rcbMonth" runat="server" Visible="false" Width="186px" Label="Month: " AutoPostBack="true" OnSelectedIndexChanged="rcbMonth_SelectedIndexChanged">
                </telerik:RadComboBox>
            </div>
            <p class="button">
                <asp:Button ID="Button1" runat="server" Text="Show Report Year/Month" OnClick="Button1_Click" />
            </p>
            <div>
                <p>
                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Administrator/printer-icon.png" Visible="false" OnClick="ImageButton1_Click" />
                </p>
            </div>
            <div class="UserGrid">
                <telerik:RadGrid ID="UserGrid" runat="server" Visible="false" CellSpacing="0" GridLines="None" AllowPaging="true" PageSize="10" OnItemCommand="UserGrid_ItemCommand" Height="400">
                   <AlternatingItemStyle BackColor="Green" />
                     <ExportSettings HideStructureColumns="true">
                    </ExportSettings>
                    <MasterTableView CommandItemDisplay="Top" AutoGenerateColumns="false"+>
                        <CommandItemSettings ShowAddNewRecordButton="false" />
                        <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                        <CommandItemSettings ShowExportToExcelButton="true" ShowExportToCsvButton="false" ShowExportToWordButton="false" />
                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>
 
                        <Columns>
                            <telerik:GridBoundColumn DataField="FirstName" FilterControlAltText="Filter FirstName column" HeaderText="First Name" SortExpression="FirstName" UniqueName="FirstName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="LastName" FilterControlAltText="Filter LastName column" HeaderText="Last Name" SortExpression="LastName" UniqueName="LastName">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="1" HeaderText="1" UniqueName="1"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="2" HeaderText="2" UniqueName="2"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="3" HeaderText="3" UniqueName="3"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="4" HeaderText="4" UniqueName="4"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="5" HeaderText="5" UniqueName="5"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="6" HeaderText="6" UniqueName="6"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="7" HeaderText="7" UniqueName="7"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="8" HeaderText="8" UniqueName="8"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="9" HeaderText="9" UniqueName="9"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="10" HeaderText="10" UniqueName="10"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="11" HeaderText="11" UniqueName="11"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="12" HeaderText="12" UniqueName="12"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="13" HeaderText="13" UniqueName="13"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="14" HeaderText="14" UniqueName="14"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="15" HeaderText="15" UniqueName="15"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="16" HeaderText="16" UniqueName="16"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="17" HeaderText="17" UniqueName="17"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="18" HeaderText="18" UniqueName="18"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="19" HeaderText="19" UniqueName="19"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="20" HeaderText="20" UniqueName="20"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="21" HeaderText="21" UniqueName="21"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="22" HeaderText="22" UniqueName="22"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="23" HeaderText="23" UniqueName="23"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="24" HeaderText="24" UniqueName="24"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="25" HeaderText="25" UniqueName="25"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="26" HeaderText="26" UniqueName="26"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="27" HeaderText="27" UniqueName="27"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="28" HeaderText="28" UniqueName="28"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="29" HeaderText="29" UniqueName="29"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="30" HeaderText="30" UniqueName="30"></telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="31" HeaderText="31" UniqueName="31"></telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
 
                </telerik:RadGrid>
            </div>
    </telerik:RadAjaxPanel>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
</asp:Content>

code behind 

using HolidayTracker.Code;
using HolidayTracker.Data.Model;
using HolidayTracker.Report;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using eis = Telerik.Web.UI.ExportInfrastructure;
 
namespace HolidayTracker.Testing
{
    public partial class YearMonthReaport : System.Web.UI.Page
    {
        private HtUser user;
        private HtUser User
        {
            get
            {
                user = HtUser.INIT_USER(this.Page, true);
                return user;
            }
        }
 
        #region Views
        private HtVacationDay selectYear
        {
            get
            {
                return (HtVacationDay)ViewState["selectYear"];
            }
            set
            {
                ViewState["selectYear"] = value;
            }
 
        }
        private  HtVacationDay selectMonth
        {
            get
            {
                return (HtVacationDay)ViewState["selectMonth"];
            }
            set
            {
                ViewState["selectMonth"] = value;
            }
 
        }
 
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadYear();
                LoadMonth();
            }
            if (User.HtUserRoles.Where(u => u.Name == UserRoles.LbuLeader.ToString()).Any())
            {
                this.rcbYear.Visible = true;
                this.rcbMonth.Visible = true;
            }
            if (User.HtUserRoles.Where(u => u.Name == UserRoles.Administrator.ToString()).Any())
            {
                this.rcbMonth.Visible = true;
                this.rcbYear.Visible = true;
            }
            else if (User.HtUserRoles.Where(u => u.Name == UserRoles.BuLeader.ToString()).Any())
            {
                this.rcbMonth.Visible = true;
                this.rcbYear.Visible = true;
 
            }
            else if (User.HtUserRoles.Where(u => u.Name == UserRoles.DepartmentLeader.ToString()).Any())
            {
                this.rcbMonth.Visible = true;
                this.rcbYear.Visible = true;
            }
            else if (User.HtUserRoles.Where(u => u.Name == UserRoles.BackOffice.ToString()).Any())
            {
                this.rcbYear.Visible = true;
                this.rcbMonth.Visible = true;
            }
 
        }
   
        protected void LoadYear()
        {
           rcbYear.DataSource = HtVacationDay.GetAllVacationYears();
            rcbYear.DataBind();
            rcbYear.Items.Insert(0, new RadComboBoxItem("-Select a Year-"));
 
        }
 
        protected void LoadMonth()
        {
            rcbMonth.DataSource = HtVacationDay.GetAllVacationMonths();
            rcbMonth.DataBind();
            rcbMonth.Items.Insert(0,new RadComboBoxItem("-Select a Month-"));
        }
 
        protected void UserGrid_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == Telerik.Web.UI.RadGrid.ExportToExcelCommandName ||
                 e.CommandName == Telerik.Web.UI.RadGrid.ExportToWordCommandName ||
                 e.CommandName == Telerik.Web.UI.RadGrid.ExportToCsvCommandName)
            {
 
            }
            if (e.CommandName == "EnablePaging")
            {
                UserGrid.AllowPaging = true;
                UserGrid.Rebind();
            }
        }
     
        protected void Button1_Click(object sender, EventArgs e)
        {
            UserGrid.Visible = true;
            ImageButton1.Visible = true;
        }
         protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
 
            foreach (GridItem item in UserGrid.MasterTableView.GetItems(new GridItemType[] { GridItemType.Pager, GridItemType.FilteringItem }))
                item.Display = false;
 
            RadAjaxPanel1.ResponseScripts.Add("PrintRadGrid('" + UserGrid.ClientID + "')");
        }
 
 
        protected override PageStatePersister PageStatePersister
        {
            get
            { return new SessionPageStatePersister(this);}
        }
 
        protected void rcbYear_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            this.selectYear =HtVacationDay.GetById(int.Parse(e.Value));
            dataSourceFilterChanged();
        }
 
        protected void rcbMonth_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            this.selectMonth =HtVacationDay.GetById(int.Parse(e.Value));
            dataSourceFilterChanged();
        }
        private void dataSourceFilterChanged()
        {
            IEnumerable<MonthReportRowItem> reportRowItems = null;
            if (this.selectYear != null)
            {
                if (this.selectMonth != null)
                {
                    
                }
            }
            this.UserGrid.DataSource = reportRowItems;
            this.UserGrid.DataBind();
        }
         
    
 

using HolidayTracker.Data.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
 
namespace HolidayTracker.Report
{
    public class MonthReportRowItem
    {
 
        public MonthReportRowItem(HtUser user)
        {
            this.user = user;
        }
 
        public MonthReportRowItem(HtUser user, int reportYear)
        {
            this.user = user;
            this.reportYear = reportYear;
            this.monthReport = user.GetMonthReport(reportYear);
        }
 
        #region properties
        private HtVacationDay vacationday;
        private HtUser user;
        private int reportYear;
        private int[] monthReport;
 
        public string FirstName{
            get{
                return this.user.FirstName;
                
            }
        }
        public string LastName{
            get{
                return this.user.LastName;
            }
        }
        public int VacationDays{
            get{
               return this.user.GetAnnualVacationAmountByYear(this.reportYear);
            }
        }
        public int UsedVacationDays{
            get{
                return this.user.GetUsedVacation(this.reportYear);
            }
        }
        public int BookedVacationDays{
            get{
                return user.GetBookedVacation(this.reportYear);
            }
        }
        public int ForecastVacationDays{
            get{
                return (this.BookedVacationDays - this.UsedVacationDays);
            }
        }
 
        public int January{
            get{
                return this.monthReport[1];
            }
        }
        public int February{
            get{
                return this.monthReport[2];
            }
        }
        public int March{
            get{
                return this.monthReport[3];
            }
        }
        public int April{
            get{
                return this.monthReport[4];
            }
        }
        public int May{
            get{
                return this.monthReport[5];
            }
        }
        public int June{
            get{
                return this.monthReport[6];
            }
        }
        public int July{
            get{
                return this.monthReport[7];
            }
        }
        public int August{
            get{
                return this.monthReport[8];
            }
        }
        public int September{
            get{
                return this.monthReport[9];
            }
        }
        public int October{
            get{
                return this.monthReport[10];
            }
        }
        public int November{
            get{
                return this.monthReport[11];
            }
        }
        public int December{
            get{
                return this.monthReport[12];
            }
        }
 
        #endregion
    }
}


thanks for answer 
Andrey
Telerik team
 answered on 20 Nov 2012
8 answers
144 views
Heey 

How can i change the collor in the grid ? i have alredy tried with 

     <AlternatingItemStyle BorderColor="#ffffff" />

and it wont work .. 

Thanks for answer 
Shinu
Top achievements
Rank 2
 answered on 20 Nov 2012
1 answer
60 views
I have a RadGrid with some BoundColumns and standard filter that automatically filter data in the datasource. Another column shows data that is not into the bound datasource. I'm using the ItemDataBound event to fill it. The automatic filter, of course, doesn't work on it. I'm trying to create a filter template that looks like the filter of the other columns. I put a RadTextBox in it and now I'd like to put the filter button that shows the menù with the filter options as is is in the others. Is there a way to use the filter menù of the grid or I have to manually create a menù with the same look and functions?
Is there a sample somewhere?
Thank you
Kostadin
Telerik team
 answered on 20 Nov 2012
6 answers
248 views
Somebody knows how I keep a RadPanelBar expanded after refresh ?
Vikram
Top achievements
Rank 1
 answered on 20 Nov 2012
9 answers
151 views
Hi, after upgrading to the latest version 2012.2.918.40, Radchart on my designer shows Parameter is not valid for Radchart.
When executing the problem, it throws Unable to cast object of type 'Telerik.Charting.ChartXAxis' to type 'Telerik.Charting.ChartYAxis'.

Used to work well before...

Any advice appreciated. Thanks!

Regards
cwk
theBoss
Top achievements
Rank 2
 answered on 20 Nov 2012
2 answers
120 views
I'm trying to display a modal RadWindow over a page. Some part of this page is an XBAP which has been loaded inside an iframe.
The part of the RadWindow which is intersecting with the XBAP is hidden behind it.
I want the RadWindow to be the top most when opened.

Kindly suggest a solution to this problem.
Amol
Top achievements
Rank 1
 answered on 20 Nov 2012
2 answers
133 views
Hello,

I have a radcontextmenu that targets a RadDock and I'm trying to make the right click work for ipad. I saw the implementation in a radtree, but I'm trying to adopt it without success.

Thanks,

Rod

function pageLoad() {
                var isMobileSafari = (navigator.userAgent.search(/like\sMac\sOS\sX;.*Mobile\/\S+/) != -1)
                if (isMobileSafari) {
                    var ctx = document.getElementById("<%= RadDock1.ClientID "%>);
                    ctx.addEventListener('touchstart', handleTouchStart, false);
                    ctx.addEventListener('touchend', handleTouchEnd, false);
                }
            }
 
            var lastContext = null;
            var longTouchID = 0;
            var menuShown = false;
 
            function longTouch() {
                longTouchID = 0;
                menuShown = true;
 
                var ctx = document.getElementById("<%= radMenu1.ClientID "%>);
                ctx.show();
            }
 
            function handleTouchStart(e) {
                longTouchID = setTimeout(longTouch, 1000);
            }
 
            function handleClick(e) {
                if (menuShown) {
                    menuShown = false;
                    document.body.removeEventListener('click', handleClick, true);
                    e.stopPropagation();
                    e.preventDefault();
                }
            }
 
            function handleTouchEnd(e) {
                if (longTouchID != 0)
                    clearTimeout(longTouchID);
                if (menuShown) {
                    document.body.addEventListener('click', handleClick, true);
                    e.preventDefault();
                }
            }
AMS
Top achievements
Rank 1
 answered on 20 Nov 2012
3 answers
133 views
Hi,

I have an Issue in GridDropDownColumn .. I want to set the (DataSourceID ,, ListTextField ,, ListValueField)
in Code-behind Dynamicaly for each Row based on some Condition.

the following Code is Changing the values of each Property but It's not binding or Reflecting anything..

Designer:
<telerik:GridCheckBoxColumn DataField="IsCustomer" SortExpression="IsCustomer"
    UniqueName="IsCustomer" DataType="System.Boolean" ReadOnly="true" Visible="false" >
</telerik:GridCheckBoxColumn>
 
<telerik:GridDropDownColumn DataField="CustomerID" UniqueName="CustomerID" 
    EnableEmptyListItem="True" >
    <HeaderStyle Width="120px" />
    <ItemStyle Width="120px" />
</telerik:GridDropDownColumn>
 
<telerik:GridDropDownColumn DataField="ContactID" UniqueName="ContactID"
     EnableEmptyListItem="True" >
    <HeaderStyle Width="100px" />
    <ItemStyle Width="100px" />
</telerik:GridDropDownColumn>

Code :
Protected Sub rgOpportunities_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgOpportunities.ItemDataBound
    If (TypeOf e.Item Is GridDataItem) Then
        'If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) Then
        Dim editFormItem As GridDataItem = CType(e.Item, GridDataItem)
        Dim Cus As GridDropDownColumn = CType(rgOpportunities.MasterTableView.Columns(8), GridDropDownColumn)
        Dim Con As GridDropDownColumn = CType(rgOpportunities.MasterTableView.Columns(9), GridDropDownColumn)
        If DirectCast(editFormItem("IsCustomer").Controls(0), CheckBox).Checked = True Then
            Cus.DataSourceID = "odsCustomer"
            Cus.ListTextField = "Name"
            Cus.ListValueField = "CustomerID"
            Con.DataSourceID = "odsContact"
            Con.ListTextField = "Name"
            Con.ListValueField = "ContactID"
        Else
            Cus.DataSourceID = "odsLeadHdr"
            Cus.ListTextField = "Name"
            Cus.ListValueField = "LeadHdrID"
            Con.DataSourceID = "odsLeadDtl"
            Con.ListTextField = "Name"
            Con.ListValueField = "LeadDtlID"
        End If
    End If
End Sub

Thanks..
Shinu
Top achievements
Rank 2
 answered on 20 Nov 2012
1 answer
231 views
I cannot get the events to fire??? Thoughts?


SERVER SIDE
protected void rtvLyst_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
{
e.Node.Text = "NodeClick fired for this node";
}


CONTROL
<div class="lystList" style="display:none; min-width:100px; min-height:200px;">
<telerik:RadTreeView ID="rtvLyst" runat="server" OnClientNodeClicked="ClientNodeClicked" OnNodeClick="rtvLyst_NodeClick">

</telerik:RadTreeView>
</div>


CLIENT SIDE
function ClientNodeClicked(sender, eventArgs) {
var node = eventArgs.get_node();
alert("You clicked " + node.get_text());
}
Princy
Top achievements
Rank 2
 answered on 20 Nov 2012
1 answer
105 views
Hi,
I want to hide/disable the edit button dependent on what is in the row. Hypothetically speaking if there was one column (showing complete and uncomplete), and the edit button column, i only want the edit button to appear or be enabled on rows that were uncomplete.
Many Thanks
Ryan 
Shinu
Top achievements
Rank 2
 answered on 20 Nov 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?