Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
579 views
Hello,

I'm using BinaryImages in data controls (such as RadGrid) and it's great!
But I've a special need:
I'd like to get dynamically the URL of an image (/Telerik.Web.UI.WebResource.axd?imgid=XXXX...).

I've a Flash swf application which uses an XML configuration file to display pictures.
I use an ASP.NET ashx handler that generate my custom configuration.
In the handler, I've the PK ID of the object (the picture is one of the field) and the byte[]. I don't if it helps...

Is there a Telerik solution for that?

Thanks.
Dimo
Telerik team
 answered on 10 May 2010
2 answers
83 views

Hello everybody,

I make this question because I’m experienced problems in a web agenda managed by RadScheduler. When I bind 5000 registers everything goes fine, but with 60000 I experience a Sys.WebForms.PageRequestManagerServerErrorException.

I’m working with OpenAccess and the access to the database is very fast and I obtain finally a IList<Appointement> object, that I assign to a RadSecheluder datasource. Debugging the program I can see that the RadScheduler is recovering every object attribute, object by object, before show the agenda, and in that step is when the error occurs (with large number of registers only).

Thank you in advance.

Rafael
Top achievements
Rank 1
 answered on 10 May 2010
2 answers
260 views
Hi all,

I have been using RadControls for a while now and I really like them.But this dynamic Grid creation is driving me crazy.

Basically I have a page to generate dynamic reports and I am using Radgrid in a FormView to view report.
I have my grid statically declared in the markup and I create the mastertableview columns and detailtableview columns at runtime from code behind and it can have as many hierarchy level the user wants.The hierarchy mode is ServerBind.
I create the structure and properties on PageLoad.

Now the problem I am facing is I am not able to expand the detailtableview and cant navigate to the next page of the grid..
I have tried everyhting possible but cant figure wht the problem is??/
If anyone could help me with this issue it would be great...

The error im getting is : System.Data.SyntaxErrorException: Syntax error: Missing operand before 'Is' operator.
The stack trace looks like this:
[SyntaxErrorException: Syntax error: Missing operand before 'Is' operator.]
   System.Data.ExpressionParser.Parse() +6215852
   System.Data.DataExpression..ctor(DataTable table, String expression, Type type) +154
   System.Data.DataView.set_RowFilter(String value) +188
   System.Data.LinqDataView.set_RowFilter(String value) +63
   Telerik.Web.UI.GridEnumerableFromDataView.PerformTransformation() +3800
   Telerik.Web.UI.GridEnumerableFromDataView.TransformEnumerable() +24
   Telerik.Web.UI.GridTableView.GetEnumerator(Boolean useDataSource, GridEnumerableBase resolvedDataSource, ArrayList dataKeysArray) +164
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +514
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +625
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +72
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +147
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +261
   Telerik.Web.UI.GridTableView.PerformSelect() +9
   Telerik.Web.UI.GridTableView.DataBind() +363
   Telerik.Web.UI.GridDataItem.OnExpand() +474
   Telerik.Web.UI.RadGrid.OnBubbleEvent(Object source, EventArgs e) +185
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +54
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70
   Telerik.Web.UI.GridItem.OnBubbleEvent(Object source, EventArgs e) +142
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +70
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
#region Declarations and Initializations  
 
            //Create Dataclasscontext object  
            DataClassesDataContext dbcontext = new DataClassesDataContext();
          
            #region Column Info Class  
 
            //Class to hold the data of ReportColumns   
            public class colInfo  
            {  
                protected int ID;  
                protected int? reportColumnID;  
                protected int? reportID;  
                protected string tableName;  
                protected string columnName;  
                protected int? reportTableHeirarchyID;  
                protected string heading;  
                protected string description;  
                protected bool filterable;  
                protected int reportColumnTypeID;  
                protected string columnType;  
                protected string dataFormatString;  
                protected string dataType;  
                protected string emptyDataText;  
                protected bool allowFiltering;  
                protected bool allowSorting;  
                protected bool showFilterIcon;  
                protected bool showSortIcon;  
                protected string headerStyleWidth;  
                protected string aggregate;  
                protected string sortExpression;  
                protected string dataField;  
                protected string footerAggregateFormatString;  
                protected bool activeColumn;  
                protected bool removed;  
                protected DateTime? purgeDate;  
                protected int userCreatedID;  
                protected int userModifiedID;  
                protected DateTime Created;  
                protected DateTime Modified;  
 
                public colInfo(int nID, int? nreportColumnID, int? nreportID, string ntable, string ncolumnName, int? nreportTableHeirarchyID, string nheading, string ndescription,  
                               bool nfilterable, int nreportColumnTypeID, string ncolumnType, string ndataType, string ndataFormatString, string nemptyDataText,  
                               bool nallowFiltering, bool nallowSorting, bool nshowFilterIcon, bool nshowSortIcon, string nheaderStyleWidth, string naggregate,  
                               string nsortExpression, string ndataField, string nfooterAggregateFormatString, bool nactive, bool nremoved, DateTime? npurgeDate,  
                               int nuserCreatedID, int nuserModifiedID, DateTime nCreated, DateTime nModified)  
                {  
                    ID = nID;  
                    reportColumnID = nreportColumnID;  
                    reportID = nreportID;  
                    tableName = ntable;  
                    columnName = ncolumnName;  
                    reportTableHeirarchyID = nreportTableHeirarchyID;  
                    heading = nheading;  
                    description = ndescription;  
                    filterable = nfilterable;  
                    reportColumnTypeID = nreportColumnTypeID;  
                    columnType = ncolumnType;  
                    dataFormatString = ndataFormatString;  
                    dataType = ndataType;  
                    emptyDataText = nemptyDataText;  
                    allowFiltering = nallowFiltering;  
                    allowSorting = nallowSorting;  
                    showFilterIcon = nshowFilterIcon;  
                    showSortIcon = nshowSortIcon;  
                    headerStyleWidth = nheaderStyleWidth;  
                    aggregate = naggregate;  
                    sortExpression = nsortExpression;  
                    dataField = ndataField;  
                    footerAggregateFormatString = nfooterAggregateFormatString;  
                    activeColumn = nactive;  
                    removed = nremoved;  
                    purgeDate = npurgeDate;  
                    userCreatedID = nuserCreatedID;  
                    userModifiedID = nuserModifiedID;  
                    Created = nCreated;  
                    Modified = nModified;  
                }  
 
                public int Id  
                {  
                    get 
                    {  
                        return ID;  
                    }  
                    set 
                    {  
                        ID = value;  
                    }  
                }  
                public int? ReportColumnId  
                {  
                    get 
                    {  
                        return reportColumnID;  
                    }  
                    set 
                    {  
                        reportColumnID = value;  
                    }  
                }  
                public int? ReportId  
                {  
                    get 
                    {  
                        return reportID;  
                    }  
                    set 
                    {  
                        reportID = value;  
                    }  
                }  
                public string TableName  
                {  
                    get 
                    {  
                        return tableName;  
                    }  
                    set 
                    {  
                        tableName = value;  
                    }  
                }  
                public string ColumnName  
                {  
                    get 
                    {  
                        return columnName;  
                    }  
                    set 
                    {  
                        columnName = value;  
                    }  
                }  
                public int? ReportTableHeirarchyId  
                {  
                    get 
                    {  
                        return reportTableHeirarchyID;  
                    }  
                    set 
                    {  
                        reportTableHeirarchyID = value;  
                    }  
                }  
                public string Heading  
                {  
                    get 
                    {  
                        return heading;  
                    }  
                    set 
                    {  
                        heading = value;  
                    }  
                }  
                public string Description  
                {  
                    get 
                    {  
                        return description;  
                    }  
                    set 
                    {  
                        description = value;  
                    }  
                }  
                public bool Filterable  
                {  
                    get 
                    {  
                        return filterable;  
                    }  
                    set 
                    {  
                        filterable = value;  
                    }  
                }  
                public int ReportColumnTypeID  
                {  
                    get 
                    {  
                        return reportColumnTypeID;  
                    }  
                    set 
                    {  
                        reportColumnTypeID = value;  
                    }  
                }  
                public string ColumnType  
                {  
                    get 
                    {  
                        return columnType;  
                    }  
                    set 
                    {  
                        columnType = value;  
                    }  
                }  
                public string DataFormatString  
                {  
                    get 
                    {  
                        return dataFormatString;  
                    }  
                    set 
                    {  
                        dataFormatString = value;  
                    }  
                }  
                public string DataType  
                {  
                    get 
                    {  
                        return dataType;  
                    }  
                    set 
                    {  
                        dataType = value;  
                    }  
                }  
                public string EmptyDataText  
                {  
                    get 
                    {  
                        return emptyDataText;  
                    }  
                    set 
                    {  
                        emptyDataText = value;  
                    }  
                }  
                public bool AllowFiltering  
                {  
                    get 
                    {  
                        return allowFiltering;  
                    }  
                    set 
                    {  
                        allowFiltering = value;  
                    }  
                }  
                public bool AllowSorting  
                {  
                    get 
                    {  
                        return allowSorting;  
                    }  
                    set 
                    {  
                        allowSorting = value;  
                    }  
                }  
                public bool ShowFilterIcon  
                {  
                    get 
                    {  
                        return showFilterIcon;  
                    }  
                    set 
                    {  
                        showFilterIcon = value;  
                    }  
                }  
                public bool ShowSortIcon  
                {  
                    get 
                    {  
                        return showSortIcon;  
                    }  
                    set 
                    {  
                        showSortIcon = value;  
                    }  
                }  
                public string HeaderStyleWidth  
                {  
                    get 
                    {  
                        return headerStyleWidth;  
                    }  
                    set 
                    {  
                        headerStyleWidth = value;  
                    }  
                }  
                public string Aggregate  
                {  
                    get 
                    {  
                        return aggregate;  
                    }  
                    set 
                    {  
                        aggregate = value;  
                    }  
                }  
                public string SortExpression  
                {  
                    get 
                    {  
                        return sortExpression;  
                    }  
                    set 
                    {  
                        sortExpression = value;  
                    }  
                }  
                public string DataField  
                {  
                    get 
                    {  
                        return dataField;  
                    }  
                    set 
                    {  
                        dataField = value;  
                    }  
                }  
                public string FooterAggregateFormatString  
                {  
                    get 
                    {  
                        return footerAggregateFormatString;  
                    }  
                    set 
                    {  
                        footerAggregateFormatString = value;  
                    }  
                }  
                public bool ActiveColumn  
                {  
                    get 
                    {  
                        return activeColumn;  
                    }  
                    set 
                    {  
                        activeColumn = value;  
                    }  
                }  
                public bool Removed  
                {  
                    get 
                    {  
                        return removed;  
                    }  
                    set 
                    {  
                        removed = value;  
                    }  
                }  
                public DateTime? PurgeDate  
                {  
                    get 
                    {  
                        return purgeDate;  
                    }  
                    set 
                    {  
                        purgeDate = value;  
                    }  
                }  
                public int UserCreatedId  
                {  
                    get 
                    {  
                        return userCreatedID;  
                    }  
                    set 
                    {  
                        userCreatedID = value;  
                    }  
                }  
                public int UserModifiedId  
                {  
                    get 
                    {  
                        return userModifiedID;  
                    }  
                    set 
                    {  
                        userModifiedID = value;  
                    }  
                }  
                public DateTime created  
                {  
                    get 
                    {  
                        return Created;  
                    }  
                    set 
                    {  
                        Created = value;  
                    }  
                }  
                public DateTime modified  
                {  
                    get 
                    {  
                        return Modified;  
                    }  
                    set 
                    {  
                        Modified = value;  
                    }  
                }  
            }
            #endregion  
 
            #region Filter Info Class  
 
            //Class to hold the data of filter data for report  
            public class filterInfo  
            {  
                int ID;  
                string colName;  
                string colDataType;  
                string colValue;  
                string tableName;  
                int? reportTableHeirarchyID;  
 
                public filterInfo(int Id, string cName, string cDataType, string cValue, string tName, int? treportTableHeirarchyID)  
                {  
                    ID = Id;  
                    colName = cName;  
                    colValue = cValue;  
                    tableName = tName;  
                    colDataType = cDataType;  
                    reportTableHeirarchyID = treportTableHeirarchyID;  
                }  
                public int Id  
                {  
                    get 
                    {  
                        return ID;  
                    }  
                    set 
                    {  
                        ID = value;  
                    }  
                }  
                public string ColName  
                {  
                    get 
                    {  
                        return colName;  
                    }  
                    set 
                    {  
                        colName = value;  
                    }  
                }  
                public string ColDataType  
                {  
                    get 
                    {  
                        return colDataType;  
                    }  
                    set 
                    {  
                        colDataType = value;  
                    }  
                }  
                public string ColValue  
                {  
                    get 
                    {  
                        return colValue;  
                    }  
                    set 
                    {  
                        colValue = value;  
                    }  
                }  
                public string TableName  
                {  
                    get 
                    {  
                        return tableName;  
                    }  
                    set 
                    {  
                        tableName = value;  
                    }  
                }  
                public int? ReportTableHeirarchyId  
                {  
                    get 
                    {  
                        return reportTableHeirarchyID;  
                    }  
                    set 
                    {  
                        reportTableHeirarchyID = value;  
                    }  
                }  
            }
            #endregion  
 
        #endregion
        #region Page Load  
 
            //Function Page Load  
            protected void Page_Load(object sender, EventArgs e)  
            {  
                if (!IsPostBack && !IsCallback)  
                {  
                    createReportMenu();  
                    if (((from data in dbcontext.userDetails where data.userID == SessionWrapper.userID && data.role.customer.waivestarCustomer == true select data).Count() > 0) == true)  
                    {  
                        foreach (RadMenuItem item in reportRadMenu.Items)  
                        {  
                            (item.Items.FindItemByText("New Report")).Visible = true;  
                            (item.Items.FindItemByText("Edit Report")).Visible = true;  
                        }  
                    }  
                    else 
                    {  
                        foreach (RadMenuItem item in reportRadMenu.Items)  
                        {  
                            (item.Items.FindItemByText("New Report")).Visible = false;  
                            (item.Items.FindItemByText("Edit Report")).Visible = true;  
                        }  
                    }  
 
                    switch (Request.QueryString["type"])  
                    {  
                        case "Insert": newReport();  
                            break;  
 
                        case "Edit": editReport();  
                            break;  
 
                        case "ReadOnly": viewReport();  
                            break;  
                    }  
                }              
            }  
 
            //Function to create the reports RadMenu  
            protected void createReportMenu()  
            {  
                //determine which reports the user can see              
                businessLevel bl = (from b in dbcontext.businessLevels where b.businessLevelID == SessionWrapper.businessLevelID select b).FirstOrDefault();  
                int[] arr = new int[(int)bl.lvl];  
                arr[(int)bl.lvl - 1] = (int)bl.businessLevelID;  
                int? currentParent = bl.parentID;  
                while (currentParent != null)  
                {  
                    businessLevel parent = (from b in dbcontext.businessLevels where b.businessLevelID == currentParent select b).FirstOrDefault();  
                    arr[(int)parent.lvl - 1] = (int)currentParent;  
                    currentParent = parent.parentID;  
                }  
 
                var reps = (from r in dbcontext.reports  
                            join rrv in dbcontext.reportRoleVisibilities on r.reportID equals rrv.reportID into v  
                            from rrv in v.DefaultIfEmpty()  
                            join rbl in dbcontext.reportBusinessLevelVisibilities on r.reportID equals rbl.reportID into b  
                            from rbl in b.DefaultIfEmpty()  
                            where rrv.roleID == SessionWrapper.roleID ||  
                            arr.Contains(rbl.businessLevelID) ||  
                            r.customerID == SessionWrapper.customerID  
                            select r).Distinct();  
 
                reportRadMenu.DataSource = reps;  
                reportRadMenu.DataBind();  
 
                foreach (RadMenuItem menuItem in reportRadMenu.Items)  
                {  
                    //Creating Child Item  
                    RadMenuItem newItem = new RadMenuItem("New Report");  
                    newItem.ImageUrl = Page.ClientScript.GetWebResourceUrl(typeof(RadTreeView), "Telerik.Web.UI.Skins." + SessionWrapper.skin + ".Grid.AddRecord.gif");  
                    menuItem.Items.Add(newItem);  
                    RadMenuItem editItem = new RadMenuItem("Edit Report");  
                    editItem.ImageUrl = Page.ClientScript.GetWebResourceUrl(typeof(RadTreeView), "Telerik.Web.UI.Skins." + SessionWrapper.skin + ".Grid.Update.gif");  
                    menuItem.Items.Add(editItem);  
                }  
            }
        #endregion  
 
        #region Report Menu Selection  
 
            //Event Handler - OnItemClick for the Report RadMenu  
            protected void reportRadMenuItemClick(object sender, RadMenuEventArgs e)  
            {  
                switch (e.Item.Text)  
                {  
                    case "New Report":Response.Redirect("~/reportGenerateReport.aspx?type=Insert&reportID=" + 0);  
                        break;  
 
                    case "Edit Report": RadMenuItem selectedItem = (RadMenuItem)e.Item.Parent;  
                        selectedItem.Selected = true;  
                        Response.Redirect("~/reportGenerateReport.aspx?type=Edit&reportID=" + selectedItem.Value);                          
                        break;  
 
                    default: Response.Redirect("~/reportGenerateReport.aspx?type=ReadOnly&reportID=" + e.Item.Value);   
                        break;               
                }  
            }
        #endregion  
 
        #region Filter/View Report  
 
            //Function to view the report  
            protected void viewReport()  
            {  
                reportFormView.DefaultMode = FormViewMode.ReadOnly;  
                reportFormView.ChangeMode(FormViewMode.ReadOnly);  
                //Retrieving the reports data  
                var report = from repData in dbcontext.reports  
                             where repData.reportID == int.Parse(Request.QueryString["reportID"])  
                             select repData;  
 
                if (report.Count() != 0)  
                {  
                    reportFormView.DataSource = report;  
                    reportFormView.DataBind();  
 
                    RadGrid grid = (RadGrid)reportFormView.FindControl("reportGrid");  
                    RadAjaxPanel1.Visible = false;  
                    //Checking filterable columns for the report                  
                    var filter = from filterData in dbcontext.reportColumns  
                                 where filterData.reportID == int.Parse(Request.QueryString["reportID"]) &&  
                                       filterData.filterable == true 
                                 select new 
                                 {  
                                     filterData.dataType,  
                                     filterData.columnName,  
                                     filterData.reportID,  
                                     reportTableListID = filterData.report.reportTableListID,  
                                     filterData.reportTableHeirarchyID  
                                 };  
 
                    //Displaying filters for the report if applicable else present thme with the report data  
                    if (filter.Count() != 0)  
                    {  
                        //Retrieving the filters data  
                        var filters = (from filterData in filter.AsEnumerable()  
                                       select new 
                                       {  
                                           filterData.dataType,  
                                           filterData.reportID,  
                                           filterData.reportTableHeirarchyID,  
                                           columnName = (string.IsNullOrEmpty(filterData.reportTableHeirarchyID.ToString()) ? filterData.columnName : filterData.reportTableHeirarchyID.ToString()),  
                                           tableName = (string.IsNullOrEmpty(filterData.reportTableHeirarchyID.ToString()) ? (from data in dbcontext.reportTableLists where data.reportTableListID == filterData.reportTableListID select data.name).First() :  
                                                                                                                             (from data in dbcontext.reportTableHeirarchyLists where data.reportTableHeirarchyListID == (from dat in dbcontext.reportTableHeirarchies where dat.reportTableHeirarchyID == filterData.reportTableHeirarchyID select dat.reportTableHeirarchyListID).First() select data.name).First()),  
                                           labelText = (string.IsNullOrEmpty(filterData.reportTableHeirarchyID.ToString()) ? (from data in dbcontext.reportTableLists where data.reportTableListID == filterData.reportTableListID select data.name).First() + "-" + filterData.columnName :  
                                                                                                                             (from data in dbcontext.reportTableHeirarchyLists where data.reportTableHeirarchyListID == (from dat in dbcontext.reportTableHeirarchies where dat.reportTableHeirarchyID == filterData.reportTableHeirarchyID select dat.reportTableHeirarchyListID).First() select data.name).First() + "-" + filterData.columnName)  
                                       }).ToList();  
 
                        //databinding the filters Repeater  
                        ((System.Web.UI.WebControls.Panel)reportFormView.FindControl("reportPanel")).Visible = false;  
                        ((System.Web.UI.WebControls.Panel)reportFormView.FindControl("filterPanel")).Visible = true;  
                        ((Repeater)reportFormView.FindControl("filterRepeater")).DataSource = filters;  
                        ((Repeater)reportFormView.FindControl("filterRepeater")).DataBind();  
                        //createReport();  
                    }  
                    else 
                    {  
                        ((System.Web.UI.WebControls.Panel)reportFormView.FindControl("reportPanel")).Visible = true;  
                        ((System.Web.UI.WebControls.Panel)reportFormView.FindControl("filterPanel")).Visible = false;  
                        createReport();  
                    }  
                    //RadAjaxManagerProxy1.AjaxSettings.AddAjaxSetting(grid, grid);  
                }  
            }  
 
            //Function called when 'Filter' button is clicked to confirm the filtering of the report data  
            protected void btFilterClick(object sender, EventArgs e)  
            {  
                Button bt = (Button)sender;  
                int count = 0;  
                Session["filterList"] = null;  
 
                foreach (RepeaterItem item in ((Repeater)reportFormView.FindControl("filterRepeater")).Items)  
                {  
                    if (Session["filterList"] != null)  
                    {  
                        if (item.FindControl("textboxPanel").Visible == true)  
                        {  
                            if (!string.IsNullOrEmpty(((RadTextBox)item.FindControl("rtbFilterTextBox")).Text))  
                            {  
                                ArrayList filterList = (ArrayList)Session["filterList"];  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbTextBoxLabel1")).Attributes["column"], "string", ((RadTextBox)item.FindControl("rtbFilterTextBox")).Text, ((System.Web.UI.WebControls.Label)item.FindControl("lbTextBoxLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbTextBoxLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbTextBoxLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                        }  
                        if (item.FindControl("numericTextBoxPanel").Visible == true)  
                        {  
                            if (!string.IsNullOrEmpty(((RadNumericTextBox)item.FindControl("rtbFilterNumericTextBox")).Text))  
                            {  
                                ArrayList filterList = (ArrayList)Session["filterList"];  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbNTextBoxLabel1")).Attributes["column"], "number", ((RadNumericTextBox)item.FindControl("rtbFilterNumericTextBox")).Text, ((System.Web.UI.WebControls.Label)item.FindControl("lbNTextBoxLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbNTextBoxLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbNTextBoxLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                        }  
                        if (item.FindControl("decimalTextBoxPanel").Visible == true)  
                        {  
                            if (!string.IsNullOrEmpty(((RadNumericTextBox)item.FindControl("rtbFilterDecimalTextBox")).Text))  
                            {  
                                ArrayList filterList = (ArrayList)Session["filterList"];  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbDTextBoxLabel1")).Attributes["column"], "decimal", ((RadNumericTextBox)item.FindControl("rtbFilterDecimalTextBox")).Text, ((System.Web.UI.WebControls.Label)item.FindControl("lbDTextBoxLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbDTextBoxLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbDTextBoxLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                        }  
                        if (item.FindControl("datePickerPanel").Visible == true)  
                        {  
                            if (!string.IsNullOrEmpty(((RadDatePicker)item.FindControl("rdpFilterFrom")).SelectedDate.ToString()))  
                            {  
                                ArrayList filterList = (ArrayList)Session["filterList"];  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["column"] + "From""date", ((RadDatePicker)item.FindControl("rdpFilterFrom")).SelectedDate.ToString(), ((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                            if (!string.IsNullOrEmpty(((RadDatePicker)item.FindControl("rdpFilterTo")).SelectedDate.ToString()))  
                            {  
                                ArrayList filterList = (ArrayList)Session["filterList"];  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["column"] + "To""date", ((RadDatePicker)item.FindControl("rdpFilterFrom")).SelectedDate.ToString(), ((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                        }  
                        if (item.FindControl("booleanCheckBoxPanel").Visible == true)  
                        {  
                            if (((CheckBox)item.FindControl("cbFilterCheckBox")).Checked)  
                            {  
                                ArrayList filterList = (ArrayList)Session["filterList"];  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbCheckBoxLabel1")).Attributes["column"], "bool", ((CheckBox)item.FindControl("cbFilterCheckBox")).Checked.ToString(), ((System.Web.UI.WebControls.Label)item.FindControl("lbCheckBoxLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbCheckBoxLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbCheckBoxLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                        }  
                    }  
                    else 
                    {  
                        if (item.FindControl("textboxPanel").Visible == true)  
                        {  
                            if (!string.IsNullOrEmpty(((RadTextBox)item.FindControl("rtbFilterTextBox")).Text))  
                            {  
                                ArrayList filterList = new ArrayList();  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbTextBoxLabel1")).Attributes["column"], "string", ((RadTextBox)item.FindControl("rtbFilterTextBox")).Text, ((System.Web.UI.WebControls.Label)item.FindControl("lbTextBoxLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbTextBoxLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbTextBoxLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                        }  
                        if (item.FindControl("numericTextBoxPanel").Visible == true)  
                        {  
                            if (!string.IsNullOrEmpty(((RadNumericTextBox)item.FindControl("rtbFilterNumericTextBox")).Text))  
                            {  
                                ArrayList filterList = new ArrayList();  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbNTextBoxLabel1")).Attributes["column"], "number", ((RadNumericTextBox)item.FindControl("rtbFilterNumericTextBox")).Text, ((System.Web.UI.WebControls.Label)item.FindControl("lbNTextBoxLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbNTextBoxLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbNTextBoxLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                        }  
                        if (item.FindControl("decimalTextBoxPanel").Visible == true)  
                        {  
                            if (!string.IsNullOrEmpty(((RadNumericTextBox)item.FindControl("rtbFilterDecimalTextBox")).Text))  
                            {  
                                ArrayList filterList = new ArrayList();  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbDTextBoxLabel1")).Attributes["column"], "decimal", ((RadNumericTextBox)item.FindControl("rtbFilterDecimalTextBox")).Text, ((System.Web.UI.WebControls.Label)item.FindControl("lbDTextBoxLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbDTextBoxLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbDTextBoxLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                        }  
                        if (item.FindControl("datePickerPanel").Visible == true)  
                        {  
                            if (!string.IsNullOrEmpty(((RadDatePicker)item.FindControl("rdpFilterFrom")).SelectedDate.ToString()))  
                            {  
                                ArrayList filterList = new ArrayList();  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["column"] + "From""date", ((RadDatePicker)item.FindControl("rdpFilterFrom")).SelectedDate.ToString(), ((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                            if (!string.IsNullOrEmpty(((RadDatePicker)item.FindControl("rdpFilterTo")).SelectedDate.ToString()))  
                            {  
                                ArrayList filterList = new ArrayList();  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["column"] + "To""date", ((RadDatePicker)item.FindControl("rdpFilterFrom")).SelectedDate.ToString(), ((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbDateFromLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                        }  
                        if (item.FindControl("booleanCheckBoxPanel").Visible == true)  
                        {  
                            if (((CheckBox)item.FindControl("cbFilterCheckBox")).Checked)  
                            {  
                                ArrayList filterList = new ArrayList();  
                                filterList.Add(new filterInfo(count, ((System.Web.UI.WebControls.Label)item.FindControl("lbCheckBoxLabel1")).Attributes["column"], "bool", ((CheckBox)item.FindControl("cbFilterCheckBox")).Checked.ToString(), ((System.Web.UI.WebControls.Label)item.FindControl("lbCheckBoxLabel1")).Attributes["table"], (!string.IsNullOrEmpty(((System.Web.UI.WebControls.Label)item.FindControl("lbCheckBoxLabel1")).Attributes["hierarchyID"]) ? (int?)int.Parse(((System.Web.UI.WebControls.Label)item.FindControl("lbCheckBoxLabel1")).Attributes["hierarchyID"]) : (int?)null)));  
                                Session["filterList"] = filterList;  
                                count++;  
                            }  
                        }  
                    }  
                }  
                ((System.Web.UI.WebControls.Panel)reportFormView.FindControl("reportPanel")).Visible = true;  
                ((System.Web.UI.WebControls.Panel)reportFormView.FindControl("filterPanel")).Visible = false;  
                createReport();  
                ((RadGrid)reportFormView.FindControl("reportGrid")).Rebind();  
            }  
 
            //Function called when 'Cancel' button is clicked to cancel the filtering of the report data  
            protected void btCancelFilterClick(object sender, EventArgs e)  
            {  
                createReport();  
            }  
 
            //Function to check whether the ReportColumns are filterable or not  
            protected void createReport()  
            {  
                //Retrieving the reports data  
                var report = from repData in dbcontext.reports  
                             where repData.reportID == int.Parse(Request.QueryString["reportID"])  
                             select repData;  
 
                if (report.Count() != 0)  
                {                      
                    RadGrid reportGrid = ((RadGrid)reportFormView.FindControl("reportGrid"));                      
                    reportGrid.MasterTableView.Columns.Clear();  
                    reportGrid.PageSize = report.First().pageSize;  
                    reportGrid.MasterTableView.PageSize = report.First().pageSize;  
                    reportGrid.MasterTableView.AutoGenerateColumns = false;  
                    reportGrid.MasterTableView.DataKeyNames = dbcontext.GetPrimaryKeyByTable(report.First().reportTableList.name);  
                    if (report.First().hierarchical != true)  
                    {  
                        //Creating and Adding columns for the MasterTableView   
                        reportGridMasterTableViewColumns(reportGrid);  
                    }  
                    else 
                    {  
                        if (report.First().hierarchical == true)  
                        {  
                            //Retrieving data for the hierarchies to be added to the MasterTableView   
                            //i.e at Second Level Hierarchy - the hierarhcies with parent id as 'Null'  
                            var hierarchies = from hierData in dbcontext.reportTableHeirarchies  
                                              where hierData.reportID == int.Parse(Request.QueryString["reportID"]) &&  
                                              hierData.parentID == null && hierData.active == true &&  
                                              hierData.removed == false 
                                              select hierData;  
 
                            if (hierarchies.Count() != 0)  
                            {  
                                //Creating the DetailTable to MasterTableView  
                                createMasterViewDetailTable(reportGrid, hierarchies);  
                                //Creating and Adding columns for the MasterTableView   
                                reportGridMasterTableViewColumns(reportGrid);  
                            }  
                        }  
                    }                      
                }  
            }  
 
            //Function to create dynamic columns for the MasterTableView of report RadGrid  
            protected void reportGridMasterTableViewColumns(RadGrid reportGrid)  
            {  
                var reportColumns = from data in dbcontext.reportColumns  
                                    where data.reportID == int.Parse(Request.QueryString["reportID"]) &&  
                                          data.reportTableHeirarchyID == null &&  
                                          data.active == true && data.removed == false 
                                    select data;  
 
                if (reportColumns.Count() != 0)  
                {                    
                    bool duplicatePKColumn = false;  
                    //Checking if primary key column is included in report columns or not  
                    foreach (var data in reportColumns)  
                    {  
                        if (data.columnName == reportGrid.MasterTableView.DataKeyNames[0])  
                        {  
                            duplicatePKColumn = true;  
                            break;  
                        }  
                    }  
                    if (duplicatePKColumn == false)  
                    {  
                        //Adding a default primary key column to the collection  
                        GridBoundColumn gridDefaultColumn = new GridBoundColumn();  
                        //Add primary key column to the collection  
                        reportGrid.MasterTableView.Columns.Add(gridDefaultColumn);  
                        //Then set properties                                                                                                         
                        gridDefaultColumn.DataField = reportGrid.MasterTableView.DataKeyNames[0];  
                        gridDefaultColumn.UniqueName = reportGrid.MasterTableView.DataKeyNames[0];  
                        gridDefaultColumn.Visible = false;  
                    }  
                    foreach (var data in reportColumns)  
                    {  
                        switch (data.reportColumnType.name)  
                        {  
                            case "GridBoundColumn":  
 
                                GridBoundColumn gridBColumn = new GridBoundColumn();  
                                //Add column to the collection  
                                reportGrid.MasterTableView.Columns.Add(gridBColumn);  
 
                                //Then set properties                                                                                 
                                gridBColumn.Aggregate = GridAggregateFunction.None;  
                                gridBColumn.AllowFiltering = data.allowFiltering;  
                                gridBColumn.AllowSorting = data.allowSorting;  
                                gridBColumn.DataField = data.columnName;  
                                gridBColumn.DataFormatString = data.dataFormatString;  
                                gridBColumn.DataType = Type.GetType(data.dataType);  
                                gridBColumn.EmptyDataText = data.emptyDataText;  
                                gridBColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                gridBColumn.HeaderText = data.heading;  
                                gridBColumn.HeaderTooltip = data.description;  
                                gridBColumn.ShowFilterIcon = data.showFilterIcon;  
                                gridBColumn.ShowSortIcon = data.showSortIcon;  
                                gridBColumn.SortExpression = data.sortExpression;  
                                gridBColumn.UniqueName = data.columnName;  
                                gridBColumn.Visible = data.active;  
 
                                break;  
                            case "GridCheckBoxColumn":  
 
                                GridCheckBoxColumn gridCBColumn = new GridCheckBoxColumn();  
                                //Add column to the collection  
                                reportGrid.MasterTableView.Columns.Add(gridCBColumn);  
 
                                //Then set properties                                                                                 
                                gridCBColumn.AllowFiltering = data.allowFiltering;  
                                gridCBColumn.AllowSorting = data.allowSorting;  
                                gridCBColumn.DataField = data.dataField;  
                                gridCBColumn.DataType = Type.GetType(data.dataType);  
                                gridCBColumn.HeaderText = data.heading;  
                                gridCBColumn.HeaderTooltip = data.description;  
                                gridCBColumn.ShowFilterIcon = data.showFilterIcon;  
                                gridCBColumn.ShowSortIcon = data.showSortIcon;  
                                gridCBColumn.SortExpression = data.sortExpression;  
                                gridCBColumn.UniqueName = data.columnName;  
                                gridCBColumn.Visible = data.active;  
 
                                break;  
                            case " GridBinaryImageColumn":  
                                GridBinaryImageColumn gridBIColumn = new GridBinaryImageColumn();  
                                //Add column to the collection  
                                reportGrid.MasterTableView.Columns.Add(gridBIColumn);  
 
                                //Then set properties        
                                gridBIColumn.AlternateText = data.heading;  
                                gridBIColumn.AllowFiltering = data.allowFiltering;  
                                gridBIColumn.AllowSorting = data.allowSorting;  
                                gridBIColumn.DataField = data.dataField;  
                                gridBIColumn.DataType = Type.GetType(data.dataType);  
                                gridBIColumn.HeaderText = data.heading;  
                                gridBIColumn.HeaderTooltip = data.description;  
                                gridBIColumn.ShowFilterIcon = data.showFilterIcon;  
                                gridBIColumn.ShowSortIcon = data.showSortIcon;  
                                gridBIColumn.SortExpression = data.sortExpression;  
                                gridBIColumn.UniqueName = data.columnName;  
                                gridBIColumn.Visible = data.active;  
 
                                break;  
                            case "GridCalculatedColumn":  
                                GridCalculatedColumn gridCColumn = new GridCalculatedColumn();  
                                //Add column to the collection  
                                reportGrid.MasterTableView.Columns.Add(gridCColumn);  
 
                                //Then set properties                                                                                 
                                gridCColumn.Aggregate = GridAggregateFunction.None;  
                                gridCColumn.AllowFiltering = data.allowFiltering;  
                                gridCColumn.AllowSorting = data.allowSorting;  
                                gridCColumn.DataType = Type.GetType(data.dataType);  
                                gridCColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                gridCColumn.HeaderText = data.heading;  
                                gridCColumn.HeaderTooltip = data.description;  
                                gridCColumn.ShowFilterIcon = data.showFilterIcon;  
                                gridCColumn.ShowSortIcon = data.showSortIcon;  
                                gridCColumn.SortExpression = data.sortExpression;  
                                gridCColumn.UniqueName = data.columnName;  
                                gridCColumn.Visible = data.active;  
 
                                break;  
                            case "GridDateTimeColumn":  
                                GridDateTimeColumn gridDTColumn = new GridDateTimeColumn();  
                                //Add column to the collection  
                                reportGrid.MasterTableView.Columns.Add(gridDTColumn);  
 
                                //Then set properties                                                                                 
                                gridDTColumn.Aggregate = GridAggregateFunction.None;  
                                gridDTColumn.AllowFiltering = data.allowFiltering;  
                                gridDTColumn.AllowSorting = data.allowSorting;  
                                gridDTColumn.DataField = data.dataField;  
                                gridDTColumn.DataFormatString = data.dataFormatString;  
                                gridDTColumn.DataType = Type.GetType(data.dataType);  
                                gridDTColumn.EmptyDataText = data.emptyDataText;  
                                gridDTColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                gridDTColumn.HeaderText = data.heading;  
                                gridDTColumn.HeaderTooltip = data.description;  
                                gridDTColumn.ShowFilterIcon = data.showFilterIcon;  
                                gridDTColumn.ShowSortIcon = data.showSortIcon;  
                                gridDTColumn.SortExpression = data.sortExpression;  
                                gridDTColumn.UniqueName = data.columnName;  
                                gridDTColumn.Visible = data.active;  
 
                                break;  
                            case "GridNumericColumn":  
                                GridNumericColumn gridNColumn = new GridNumericColumn();  
                                //Add column to the collection  
                                reportGrid.MasterTableView.Columns.Add(gridNColumn);  
 
                                //Then set properties                                                                                 
                                gridNColumn.Aggregate = GridAggregateFunction.None;  
                                gridNColumn.AllowFiltering = data.allowFiltering;  
                                gridNColumn.AllowSorting = data.allowSorting;  
                                gridNColumn.DataField = data.dataField;  
                                gridNColumn.DataFormatString = data.dataFormatString;  
                                gridNColumn.DataType = Type.GetType(data.dataType);  
                                if (data.dataType == "Percentage")  
                                {  
                                    gridNColumn.NumericType = NumericType.Percent;  
                                }  
                                else if (data.dataType == "Currency")  
                                {  
                                    gridNColumn.NumericType = NumericType.Currency;  
                                }  
                                else 
                                {  
                                    gridNColumn.NumericType = NumericType.Number;  
                                }  
                                gridNColumn.EmptyDataText = data.emptyDataText;  
                                gridNColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                gridNColumn.HeaderText = data.heading;  
                                gridNColumn.HeaderTooltip = data.description;  
                                gridNColumn.ShowFilterIcon = data.showFilterIcon;  
                                gridNColumn.ShowSortIcon = data.showSortIcon;  
                                gridNColumn.SortExpression = data.sortExpression;  
                                gridNColumn.UniqueName = data.columnName;  
                                gridNColumn.Visible = data.active;  
 
                                break;  
                        }                          
                    }                     
                }  
            }  
 
            //Function to create and add columns of the DetailTable-Second in hierarchy level  
            //i.e. Detail Table added to the MasterTableView of the RadGrid  
            protected void createMasterViewDetailTable(RadGrid reportGrid, IQueryable<reportTableHeirarchy> hierarchies)  
            {  
                foreach (var tempData in hierarchies)  
                {  
                    var hierTableName = (from tableData in dbcontext.reportTableHeirarchies  
                                         where tableData.reportID == tempData.reportID &&  
                                               tableData.reportTableHeirarchyID == tempData.reportTableHeirarchyID  
                                         select new { name = tableData.reportTableHeirarchyList.name }).First();  
 
                    //Adding Detail table to MasterTableView - Second in hierarchy level  
                    GridTableView hierTableView = new GridTableView(reportGrid);  
                    reportGrid.MasterTableView.DetailTables.Add(hierTableView);  
 
                    //Then Set Properties for the Detail Table  
                    hierTableView.DataKeyNames = dbcontext.GetPrimaryKeyByTable(hierTableName.name);  
                    hierTableView.DataMember = tempData.reportTableHeirarchyID.ToString();  
                    //hierTableView.HierarchyDefaultExpanded = true;  
                    hierTableView.AllowPaging = true;  
                    hierTableView.AllowSorting = true;  
                    hierTableView.AllowFilteringByColumn = true;  
                    hierTableView.AutoGenerateColumns = false;  
 
                    GridRelationFields relationFields = new GridRelationFields();  
                    relationFields.MasterKeyField = reportGrid.MasterTableView.DataKeyNames[0];  
                    relationFields.DetailKeyField = reportGrid.MasterTableView.DataKeyNames[0];  
                    hierTableView.ParentTableRelation.Add(relationFields);  
 
                    //Creating and Adding the DetailTable to MasterTableView  
                    createChildDetailTables(tempData, hierTableView);  
 
                    var hierReportColumns = from data in dbcontext.reportColumns  
                                            where data.reportID == int.Parse(Request.QueryString["reportID"]) &&  
                                                 data.reportTableHeirarchyID == tempData.reportTableHeirarchyID &&  
                                                 data.active == true && data.removed == false 
                                            select data;  
 
                    if (hierReportColumns.Count() != 0)  
                    {  
                        bool duplicatePKColumn = false;  
                        //Checking if primary key column is included in report columns or not  
                        foreach (var data in hierReportColumns)  
                        {  
                            if (data.columnName == hierTableView.DataKeyNames[0])  
                            {  
                                duplicatePKColumn = true;  
                                break;  
                            }  
                        }  
                        if (duplicatePKColumn == false)  
                        {  
                            //Adding a default primary key column to the collection  
                            GridBoundColumn gridDefaultColumn = new GridBoundColumn();  
                            //Add primary key column to the collection  
                            hierTableView.Columns.Add(gridDefaultColumn);  
 
                            //Then set properties                                                                                                         
                            gridDefaultColumn.DataField = hierTableView.DataKeyNames[0];  
                            gridDefaultColumn.UniqueName = hierTableView.DataKeyNames[0];  
                            gridDefaultColumn.Visible = false;  
                        }  
 
                        foreach (var data in hierReportColumns)  
                        {  
                            switch (data.reportColumnType.name)  
                            {  
                                case "GridBoundColumn":  
 
                                    GridBoundColumn gridBColumn = new GridBoundColumn();  
                                    //Add column to the collection  
                                    hierTableView.Columns.Add(gridBColumn);  
 
                                    //Then set properties                                                                                 
                                    gridBColumn.Aggregate = GridAggregateFunction.None;  
                                    gridBColumn.AllowFiltering = data.allowFiltering;  
                                    gridBColumn.AllowSorting = data.allowSorting;  
                                    gridBColumn.DataField = data.columnName;  
                                    gridBColumn.DataFormatString = data.dataFormatString;  
                                    gridBColumn.DataType = Type.GetType(data.dataType);  
                                    gridBColumn.EmptyDataText = data.emptyDataText;  
                                    gridBColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                    gridBColumn.HeaderText = data.heading;  
                                    gridBColumn.HeaderTooltip = data.description;  
                                    gridBColumn.ShowFilterIcon = data.showFilterIcon;  
                                    gridBColumn.ShowSortIcon = data.showSortIcon;  
                                    gridBColumn.SortExpression = data.sortExpression;  
                                    gridBColumn.UniqueName = data.columnName;  
                                    gridBColumn.Visible = data.active;  
 
                                    break;  
                                case "GridCheckBoxColumn":  
 
                                    GridCheckBoxColumn gridCBColumn = new GridCheckBoxColumn();  
                                    //Add column to the collection  
                                    hierTableView.Columns.Add(gridCBColumn);  
 
                                    //Then set properties                                                                                 
                                    gridCBColumn.AllowFiltering = data.allowFiltering;  
                                    gridCBColumn.AllowSorting = data.allowSorting;  
                                    gridCBColumn.DataField = data.dataField;  
                                    gridCBColumn.DataType = Type.GetType(data.dataType);  
                                    gridCBColumn.HeaderText = data.heading;  
                                    gridCBColumn.HeaderTooltip = data.description;  
                                    gridCBColumn.ShowFilterIcon = data.showFilterIcon;  
                                    gridCBColumn.ShowSortIcon = data.showSortIcon;  
                                    gridCBColumn.SortExpression = data.sortExpression;  
                                    gridCBColumn.UniqueName = data.columnName;  
                                    gridCBColumn.Visible = data.active;  
 
                                    break;  
                                case " GridBinaryImageColumn":  
                                    GridBinaryImageColumn gridBIColumn = new GridBinaryImageColumn();  
                                    //Add column to the collection  
                                    hierTableView.Columns.Add(gridBIColumn);  
 
                                    //Then set properties        
                                    gridBIColumn.AlternateText = data.heading;  
                                    gridBIColumn.AllowFiltering = data.allowFiltering;  
                                    gridBIColumn.AllowSorting = data.allowSorting;  
                                    gridBIColumn.DataField = data.dataField;  
                                    gridBIColumn.DataType = Type.GetType(data.dataType);  
                                    gridBIColumn.HeaderText = data.heading;  
                                    gridBIColumn.HeaderTooltip = data.description;  
                                    gridBIColumn.ShowFilterIcon = data.showFilterIcon;  
                                    gridBIColumn.ShowSortIcon = data.showSortIcon;  
                                    gridBIColumn.SortExpression = data.sortExpression;  
                                    gridBIColumn.UniqueName = data.columnName;  
                                    gridBIColumn.Visible = data.active;  
 
                                    break;  
                                case "GridCalculatedColumn":  
                                    GridCalculatedColumn gridCColumn = new GridCalculatedColumn();  
                                    //Add column to the collection  
                                    hierTableView.Columns.Add(gridCColumn);  
 
                                    //Then set properties                                                                                 
                                    gridCColumn.Aggregate = GridAggregateFunction.None;  
                                    gridCColumn.AllowFiltering = data.allowFiltering;  
                                    gridCColumn.AllowSorting = data.allowSorting;  
                                    gridCColumn.DataType = Type.GetType(data.dataType);  
                                    gridCColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                    gridCColumn.HeaderText = data.heading;  
                                    gridCColumn.HeaderTooltip = data.description;  
                                    gridCColumn.ShowFilterIcon = data.showFilterIcon;  
                                    gridCColumn.ShowSortIcon = data.showSortIcon;  
                                    gridCColumn.SortExpression = data.sortExpression;  
                                    gridCColumn.UniqueName = data.columnName;  
                                    gridCColumn.Visible = data.active;  
 
                                    break;  
                                case "GridDateTimeColumn":  
                                    GridDateTimeColumn gridDTColumn = new GridDateTimeColumn();  
                                    //Add column to the collection  
                                    hierTableView.Columns.Add(gridDTColumn);  
 
                                    //Then set properties                                                                                 
                                    gridDTColumn.Aggregate = GridAggregateFunction.None;  
                                    gridDTColumn.AllowFiltering = data.allowFiltering;  
                                    gridDTColumn.AllowSorting = data.allowSorting;  
                                    gridDTColumn.DataField = data.dataField;  
                                    gridDTColumn.DataFormatString = data.dataFormatString;  
                                    gridDTColumn.DataType = Type.GetType(data.dataType);  
                                    gridDTColumn.EmptyDataText = data.emptyDataText;  
                                    gridDTColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                    gridDTColumn.HeaderText = data.heading;  
                                    gridDTColumn.HeaderTooltip = data.description;  
                                    gridDTColumn.ShowFilterIcon = data.showFilterIcon;  
                                    gridDTColumn.ShowSortIcon = data.showSortIcon;  
                                    gridDTColumn.SortExpression = data.sortExpression;  
                                    gridDTColumn.UniqueName = data.columnName;  
                                    gridDTColumn.Visible = data.active;  
 
                                    break;  
                                case "GridNumericColumn":  
                                    GridNumericColumn gridNColumn = new GridNumericColumn();  
                                    //Add column to the collection  
                                    hierTableView.Columns.Add(gridNColumn);  
 
                                    //Then set properties                                                                                 
                                    gridNColumn.Aggregate = GridAggregateFunction.None;  
                                    gridNColumn.AllowFiltering = data.allowFiltering;  
                                    gridNColumn.AllowSorting = data.allowSorting;  
                                    gridNColumn.DataField = data.dataField;  
                                    gridNColumn.DataFormatString = data.dataFormatString;  
                                    gridNColumn.DataType = Type.GetType(data.dataType);  
                                    if (data.dataType == "Percentage")  
                                    {  
                                        gridNColumn.NumericType = NumericType.Percent;  
                                    }  
                                    else if (data.dataType == "Currency")  
                                    {  
                                        gridNColumn.NumericType = NumericType.Currency;  
                                    }  
                                    else 
                                    {  
                                        gridNColumn.NumericType = NumericType.Number;  
                                    }  
                                    gridNColumn.EmptyDataText = data.emptyDataText;  
                                    gridNColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                    gridNColumn.HeaderText = data.heading;  
                                    gridNColumn.HeaderTooltip = data.description;  
                                    gridNColumn.ShowFilterIcon = data.showFilterIcon;  
                                    gridNColumn.ShowSortIcon = data.showSortIcon;  
                                    gridNColumn.SortExpression = data.sortExpression;  
                                    gridNColumn.UniqueName = data.columnName;  
                                    gridNColumn.Visible = data.active;  
 
                                    break;  
                            }  
                        }  
                    }  
                }  
            }  
 
            //Function - Recursive to create and add columns of the DetailTable-Any hierarchy level  
            //i.e. Detail Table added to the other DetailsTables added to the MasterTableView of the RadGrid  
            protected void createChildDetailTables(reportTableHeirarchy tempData, GridTableView hierTableView)  
            {  
                //Retrieving the report Heirarchies for the next levels to the Second Level Hierarchy  
                var childHierarchies = from hierData in dbcontext.reportTableHeirarchies  
                                       where hierData.reportID == int.Parse(Request.QueryString["reportID"]) &&  
                                       hierData.active == true && hierData.removed == false &&  
                                       hierData.parentID == tempData.reportTableHeirarchyID  
                                       select hierData;  
 
                if (childHierarchies.Count() != 0)  
                {  
                    foreach (var childHiers in childHierarchies)  
                    {  
                        var hierTableName = (from tableData in dbcontext.reportTableHeirarchies  
                                             where tableData.reportID == tempData.reportID &&  
                                                   tableData.reportTableHeirarchyID == childHiers.reportTableHeirarchyID  
                                             select new { name = tableData.reportTableHeirarchyList.name }).First();  
 
                        //Adding Detail table to MasterTableView - Second in hierarchy level  
                        GridTableView childHierTableView = new GridTableView();  
                        hierTableView.DetailTables.Add(childHierTableView);  
 
                        //Then Set Properties for the Detail Table  
                        childHierTableView.DataKeyNames = dbcontext.GetPrimaryKeyByTable(hierTableName.name);  
                        childHierTableView.DataMember = childHiers.reportTableHeirarchyID.ToString();  
                        //childHierTableView.HierarchyDefaultExpanded = true;  
                        childHierTableView.AllowPaging = true;  
                        childHierTableView.AllowSorting = true;  
                        childHierTableView.AllowFilteringByColumn = true;  
                        childHierTableView.AutoGenerateColumns = false;  
 
                        GridRelationFields relationHierFields = new GridRelationFields();  
                        relationHierFields.MasterKeyField = hierTableView.DataKeyNames[0];  
                        relationHierFields.DetailKeyField = hierTableView.DataKeyNames[0];  
                        childHierTableView.ParentTableRelation.Add(relationHierFields);  
 
 
                        //Creating and Adding the DetailTable to MasterTableView  
                        createChildDetailTables(childHiers, hierTableView);  
 
                        var childHierReportColumns = from data in dbcontext.reportColumns  
                                                     where data.reportID == int.Parse(Request.QueryString["reportID"]) &&  
                                                     data.reportTableHeirarchyID == childHiers.reportTableHeirarchyID &&  
                                                     data.active == true && data.removed == false 
                                                     select data;  
 
                        if (childHierReportColumns.Count() != 0)  
                        {  
                            bool duplicatePKColumn = false;  
                            //Checking if primary key column is included in report columns or not  
                            foreach (var data in childHierReportColumns)  
                            {  
                                if (data.columnName == childHierTableView.DataKeyNames[0])  
                                {  
                                    duplicatePKColumn = true;  
                                    break;  
                                }  
                            }  
                            if (duplicatePKColumn == false)  
                            {  
                                //Adding a default primary key column to the collection  
                                GridBoundColumn gridDefaultColumn = new GridBoundColumn();  
                                //Add column to the collection  
                                hierTableView.Columns.Add(gridDefaultColumn);  
 
                                //Then set properties                                                                                                         
                                gridDefaultColumn.DataField = childHierTableView.DataKeyNames[0];  
                                gridDefaultColumn.UniqueName = childHierTableView.DataKeyNames[0];  
                                gridDefaultColumn.Visible = false;  
                            }  
 
                            foreach (var data in childHierReportColumns)  
                            {  
                                switch (data.reportColumnType.name)  
                                {  
                                    case "GridBoundColumn":  
 
                                        GridBoundColumn gridBColumn = new GridBoundColumn();  
                                        //Add column to the collection  
                                        childHierTableView.Columns.Add(gridBColumn);  
 
                                        //Then set properties                                                                                 
                                        gridBColumn.Aggregate = GridAggregateFunction.None;  
                                        gridBColumn.AllowFiltering = data.allowFiltering;  
                                        gridBColumn.AllowSorting = data.allowSorting;  
                                        gridBColumn.DataField = data.columnName;  
                                        gridBColumn.DataFormatString = data.dataFormatString;  
                                        gridBColumn.DataType = Type.GetType(data.dataType);  
                                        gridBColumn.EmptyDataText = data.emptyDataText;  
                                        gridBColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                        gridBColumn.HeaderText = data.heading;  
                                        gridBColumn.HeaderTooltip = data.description;  
                                        gridBColumn.ShowFilterIcon = data.showFilterIcon;  
                                        gridBColumn.ShowSortIcon = data.showSortIcon;  
                                        gridBColumn.SortExpression = data.sortExpression;  
                                        gridBColumn.UniqueName = data.columnName;  
                                        gridBColumn.Visible = data.active;  
 
                                        break;  
                                    case "GridCheckBoxColumn":  
 
                                        GridCheckBoxColumn gridCBColumn = new GridCheckBoxColumn();  
                                        //Add column to the collection  
                                        childHierTableView.Columns.Add(gridCBColumn);  
 
                                        //Then set properties                                                                                 
                                        gridCBColumn.AllowFiltering = data.allowFiltering;  
                                        gridCBColumn.AllowSorting = data.allowSorting;  
                                        gridCBColumn.DataField = data.dataField;  
                                        gridCBColumn.DataType = Type.GetType(data.dataType);  
                                        gridCBColumn.HeaderText = data.heading;  
                                        gridCBColumn.HeaderTooltip = data.description;  
                                        gridCBColumn.ShowFilterIcon = data.showFilterIcon;  
                                        gridCBColumn.ShowSortIcon = data.showSortIcon;  
                                        gridCBColumn.SortExpression = data.sortExpression;  
                                        gridCBColumn.UniqueName = data.columnName;  
                                        gridCBColumn.Visible = data.active;  
 
                                        break;  
                                    case " GridBinaryImageColumn":  
                                        GridBinaryImageColumn gridBIColumn = new GridBinaryImageColumn();  
                                        //Add column to the collection  
                                        childHierTableView.Columns.Add(gridBIColumn);  
 
                                        //Then set properties        
                                        gridBIColumn.AlternateText = data.heading;  
                                        gridBIColumn.AllowFiltering = data.allowFiltering;  
                                        gridBIColumn.AllowSorting = data.allowSorting;  
                                        gridBIColumn.DataField = data.dataField;  
                                        gridBIColumn.DataType = Type.GetType(data.dataType);  
                                        gridBIColumn.HeaderText = data.heading;  
                                        gridBIColumn.HeaderTooltip = data.description;  
                                        gridBIColumn.ShowFilterIcon = data.showFilterIcon;  
                                        gridBIColumn.ShowSortIcon = data.showSortIcon;  
                                        gridBIColumn.SortExpression = data.sortExpression;  
                                        gridBIColumn.UniqueName = data.columnName;  
                                        gridBIColumn.Visible = data.active;  
 
                                        break;  
                                    case "GridCalculatedColumn":  
                                        GridCalculatedColumn gridCColumn = new GridCalculatedColumn();  
                                        //Add column to the collection  
                                        childHierTableView.Columns.Add(gridCColumn);  
 
                                        //Then set properties                                                                                 
                                        gridCColumn.Aggregate = GridAggregateFunction.None;  
                                        gridCColumn.AllowFiltering = data.allowFiltering;  
                                        gridCColumn.AllowSorting = data.allowSorting;  
                                        gridCColumn.DataType = Type.GetType(data.dataType);  
                                        gridCColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                        gridCColumn.HeaderText = data.heading;  
                                        gridCColumn.HeaderTooltip = data.description;  
                                        gridCColumn.ShowFilterIcon = data.showFilterIcon;  
                                        gridCColumn.ShowSortIcon = data.showSortIcon;  
                                        gridCColumn.SortExpression = data.sortExpression;  
                                        gridCColumn.UniqueName = data.columnName;  
                                        gridCColumn.Visible = data.active;  
 
                                        break;  
                                    case "GridDateTimeColumn":  
                                        GridDateTimeColumn gridDTColumn = new GridDateTimeColumn();  
                                        //Add column to the collection  
                                        childHierTableView.Columns.Add(gridDTColumn);  
 
                                        //Then set properties                                                                                 
                                        gridDTColumn.Aggregate = GridAggregateFunction.None;  
                                        gridDTColumn.AllowFiltering = data.allowFiltering;  
                                        gridDTColumn.AllowSorting = data.allowSorting;  
                                        gridDTColumn.DataField = data.dataField;  
                                        gridDTColumn.DataFormatString = data.dataFormatString;  
                                        gridDTColumn.DataType = Type.GetType(data.dataType);  
                                        gridDTColumn.EmptyDataText = data.emptyDataText;  
                                        gridDTColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                        gridDTColumn.HeaderText = data.heading;  
                                        gridDTColumn.HeaderTooltip = data.description;  
                                        gridDTColumn.ShowFilterIcon = data.showFilterIcon;  
                                        gridDTColumn.ShowSortIcon = data.showSortIcon;  
                                        gridDTColumn.SortExpression = data.sortExpression;  
                                        gridDTColumn.UniqueName = data.columnName;  
                                        gridDTColumn.Visible = data.active;  
 
                                        break;  
                                    case "GridNumericColumn":  
                                        GridNumericColumn gridNColumn = new GridNumericColumn();  
                                        //Add column to the collection  
                                        childHierTableView.Columns.Add(gridNColumn);  
 
                                        //Then set properties                                                                                 
                                        gridNColumn.Aggregate = GridAggregateFunction.None;  
                                        gridNColumn.AllowFiltering = data.allowFiltering;  
                                        gridNColumn.AllowSorting = data.allowSorting;  
                                        gridNColumn.DataField = data.dataField;  
                                        gridNColumn.DataFormatString = data.dataFormatString;  
                                        gridNColumn.DataType = Type.GetType(data.dataType);  
                                        if (data.dataType == "Percentage")  
                                        {  
                                            gridNColumn.NumericType = NumericType.Percent;  
                                        }  
                                        else if (data.dataType == "Currency")  
                                        {  
                                            gridNColumn.NumericType = NumericType.Currency;  
                                        }  
                                        else 
                                        {  
                                            gridNColumn.NumericType = NumericType.Number;  
                                        }  
                                        gridNColumn.EmptyDataText = data.emptyDataText;  
                                        gridNColumn.FooterAggregateFormatString = data.footerAggregateFormatString;  
                                        gridNColumn.HeaderText = data.heading;  
                                        gridNColumn.HeaderTooltip = data.description;  
                                        gridNColumn.ShowFilterIcon = data.showFilterIcon;  
                                        gridNColumn.ShowSortIcon = data.showSortIcon;  
                                        gridNColumn.SortExpression = data.sortExpression;  
                                        gridNColumn.UniqueName = data.columnName;  
                                        gridNColumn.Visible = data.active;  
 
                                        break;  
                                }  
                            }  
                        }  
                    }  
                }  
            }  
 
 
            //Event Handler - OnNeedDataSource to bind the report Radgrid  
            protected void bindReportGrid(object sender, GridNeedDataSourceEventArgs e)  
            {  
                RadGrid reportGrid = (RadGrid)sender;  
                //Retrieving data for the report columns  
                var reportColumns = from data in dbcontext.reportColumns  
                                    where data.reportID == int.Parse(Request.QueryString["reportID"]) &&  
                                          data.reportTableHeirarchyID == null &&  
                                          data.active == true && data.removed == false 
                                    select data;  
 
                if (reportColumns.Count() != 0)  
                {  
                    string dynamicColumns = string.Empty;  
                    List<string> columnsToDisplay = new List<string>();  
                    StringBuilder columnsSearch = new StringBuilder();  
                    //Getting the report table name  
                    string tableName = reportColumns.First().report.reportTableList.name;  
                    foreach (var data in reportColumns)  
                    {  
                        columnsToDisplay.Add(data.columnName);  
                    }  
                    //Building the Dynamic Column Names for linq query for the report  
                    dynamicColumns = buildDynamicColumnNames(dynamicColumns, columnsToDisplay);  
                    //Building the string of Filter Values for linq query for the report  
                    columnsSearch = buildFilteredValues();  
                    //Building and Databinding the Report RadGrid  
                    Type TEntity = Type.GetType((dbcontext.GetType().Namespace + "." + tableName).ToString());  
                    var results = (dbcontext.GetTableByName(tableName));  
                    if (!string.IsNullOrEmpty(columnsSearch.ToString()) && !string.IsNullOrEmpty(dynamicColumns))  
                    {  
                        //Generating records using dynamic linq  
                        var filteredResults = results.Where(columnsSearch.ToString()).Select(dynamicColumns);  
                        if (filteredResults.Count() != 0)  
                        {  
                            //Generating records using dynamic linq  
                            var finalResults = reportRecords(TEntity, filteredResults);  
                            if (finalResults != null)  
                            {  
                                reportGrid.DataSource = finalResults;  
                            }  
                        }  
                        else 
                        {  
                            reportGrid.DataSource = string.Empty;  
                        }  
                    }  
                    else 
                    {  
                        if (!string.IsNullOrEmpty(dynamicColumns))  
                        {  
                            //Generating records using dynamic linq  
                            var filteredResults = results.Select(dynamicColumns);  
                            int startRowIndex = reportGrid.CurrentPageIndex * reportGrid.PageSize;  
                            int maximumRows = reportGrid.PageSize;                            
                            if (filteredResults.Count() != 0)  
                            {  
                                //Generating records using dynamic linq  
                                var finalResults = reportRecords(TEntity, filteredResults);  
                                if (finalResults != null)  
                                {                                      
                                    reportGrid.DataSource = finalResults;                                    
                                }  
                            }  
                            else 
                            {  
                                reportGrid.DataSource = string.Empty;  
                            }  
                        }  
                        else 
                        {  
                            if (results.Count() != 0)  
                            {  
                                //Generating records using dynamic linq  
                                var finalResults = reportRecords(TEntity, results);  
                                if (finalResults != null)  
                                {  
                                    reportGrid.DataSource = finalResults;  
                                }  
                            }  
                            else 
                            {  
                                reportGrid.DataSource = string.Empty;  
                            }  
                        }  
                    }  
                }  
            }  
              
            //EventHandler - OnDetailTableDataBind for the report RadGrid  
            protected void reportGridDetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)  
            {  
                GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem;  
                int hierarchyID = int.Parse(e.DetailTableView.DataMember);  
                int parentDataKeyID = (int)dataItem.GetDataKeyValue(dataItem.OwnerTableView.DataKeyNames[0]);  
                string hierTableName = "";  
 
                var hierReportColumns = from data in dbcontext.reportColumns  
                                        where data.reportID == int.Parse(Request.QueryString["reportID"]) &&  
                                        data.reportTableHeirarchyID == hierarchyID &&  
                                        data.active == true && data.removed == false 
                                        select data;  
 
                if (hierReportColumns.Count() != 0)  
                {  
                    string dynamicHeirColumns = string.Empty;  
                    hierTableName = hierReportColumns.First().reportTableHeirarchy.reportTableHeirarchyList.name;  
                    List<string> hierColumnsToDisplay = new List<string>();  
                    StringBuilder hierColumnsSearch = new StringBuilder();  
                    foreach (var data in hierReportColumns)  
                    {  
                        hierColumnsToDisplay.Add(data.columnName);  
                    }  
                    //Adding the DetailTableView's OwnerTableView DataKeyNames as a column to be retrieved using linq  
                    hierColumnsToDisplay.Add(dataItem.OwnerTableView.DataKeyNames[0].ToString());  
                    //Adding the DetailTableView's DataKeyNames as a column to be retrieved using linq  
                    hierColumnsToDisplay.Add(e.DetailTableView.DataKeyNames[0].ToString());  
                    //Building the Dynamic Column Names for linq query for the report  
                    dynamicHeirColumns = buildDynamicColumnNames(dynamicHeirColumns, hierColumnsToDisplay);  
                    //Building the string of Filter Values for linq query for the report  
                    hierColumnsSearch = buildFilteredValues();  
                    //Building and Databinding the Report RadGrid  
                    Type THeirEntity = Type.GetType((dbcontext.GetType().Namespace + "." + hierTableName).ToString());  
                    var hierResults = (dbcontext.GetTableByName(hierTableName));  
                    if (!string.IsNullOrEmpty(hierColumnsSearch.ToString()) && !string.IsNullOrEmpty(dynamicHeirColumns))  
                    {  
                        //Generating records using dynamic linq  
                        var filteredResults = hierResults.Where(hierColumnsSearch.ToString() + " && " + dataItem.OwnerTableView.DataKeyNames[0] + "=" + parentDataKeyID).Select(dynamicHeirColumns);  
                        if (filteredResults.Count() != 0)  
                        {  
                            //Generating records using dynamic linq  
                            var finalResults = reportRecords(THeirEntity, filteredResults);  
                            if (finalResults != null)  
                            {  
                                e.DetailTableView.DataSource = finalResults;  
                            }  
                        }  
                        else 
                        {  
                            e.DetailTableView.DataSource = string.Empty;  
                        }  
                    }  
                    else 
                    {  
                        if (!string.IsNullOrEmpty(dynamicHeirColumns))  
                        {  
                            //Generating records using dynamic linq  
                            var filteredResults = hierResults.Where(dataItem.OwnerTableView.DataKeyNames[0] + "=" + parentDataKeyID).Select(dynamicHeirColumns);  
                            if (filteredResults.Count() != 0)  
                            {  
                                //Generating records using dynamic linq  
                                var finalResults = reportRecords(THeirEntity, filteredResults);  
                                if (finalResults != null)  
                                {  
                                    e.DetailTableView.DataSource = finalResults;  
                                }  
                            }  
                            else 
                            {  
                                e.DetailTableView.DataSource = string.Empty;  
                            }  
                        }  
                        else 
                        {  
                            if (hierResults.Count() != 0)  
                            {  
                                //Generating records using dynamic linq  
                                var filteredResults = hierResults.Where(dataItem.OwnerTableView.DataKeyNames[0] + "=" + parentDataKeyID);  
                                if (filteredResults.Count() != 0)  
                                {  
                                    //Generating records using dynamic linq  
                                    var finalResults = reportRecords(THeirEntity, filteredResults);  
                                    if (finalResults != null)  
                                    {  
                                        e.DetailTableView.DataSource = finalResults;  
                                    }  
                                }  
                                else 
                                {  
                                    e.DetailTableView.DataSource = string.Empty;  
                                }  
                            }  
                            else 
                            {  
                                e.DetailTableView.DataSource = string.Empty;  
                            }  
                        }  
                    }  
                }  
            }  
 
            //Function to build the string of Filter Values for linq query for the report  
            protected StringBuilder buildFilteredValues()  
            {  
                StringBuilder columnsSearch = new StringBuilder();  
                //Building the Where statement parameters for linq query to be used for filtering of the data of the columns for the report  
                if (Session["filterList"] != null)  
                {  
                    ArrayList filterList = (ArrayList)Session["filterList"];  
                    int count = 0;  
                    foreach (filterInfo listItem in filterList)  
                    {  
                        if (count == 0 && count != (filterList.Count - 1))  
                        {  
                            switch (listItem.ColDataType)  
                            {  
                                case "string": columnsSearch.Append(listItem.ColName + "='" + listItem.ColValue + "' && ");  
                                    break;  
                                case "number": columnsSearch.Append(listItem.ColName + "=" + listItem.ColValue + " && ");  
                                    break;  
                                case "decimal": columnsSearch.Append(listItem.ColName + "=" + listItem.ColValue + " && ");  
                                    break;  
                                case "date": columnsSearch.Append(listItem.ColName + "='" + listItem.ColValue + "' && ");  
                                    break;  
                                case "bool": columnsSearch.Append(listItem.ColName + "=" + listItem.ColValue + " && ");  
                                    break;  
                            }  
                        }  
                        else if (count == (filterList.Count - 1))  
                        {  
                            switch (listItem.ColDataType)  
                            {  
                                case "string": columnsSearch.Append(listItem.ColName + "='" + listItem.ColValue + "'");  
                                    break;  
                                case "number": columnsSearch.Append(listItem.ColName + "=" + listItem.ColValue);  
                                    break;  
                                case "decimal": columnsSearch.Append(listItem.ColName + "=" + listItem.ColValue);  
                                    break;  
                                case "date": columnsSearch.Append(listItem.ColName + "='" + listItem.ColValue + "'");  
                                    break;  
                                case "bool": columnsSearch.Append(listItem.ColName + "=" + listItem.ColValue);  
                                    break;  
                            }  
                        }  
                        else 
                        {  
                            switch (listItem.ColDataType)  
                            {  
                                case "string": columnsSearch.Append(listItem.ColName + "='" + listItem.ColValue + "' && ");  
                                    break;  
                                case "number": columnsSearch.Append(listItem.ColName + "=" + listItem.ColValue + " && ");  
                                    break;  
                                case "decimal": columnsSearch.Append(listItem.ColName + "=" + listItem.ColValue + " && ");  
                                    break;  
                                case "date": columnsSearch.Append(listItem.ColName + "='" + listItem.ColValue + "' && ");  
                                    break;  
                                case "bool": columnsSearch.Append(listItem.ColName + "=" + listItem.ColValue + " && ");  
                                    break;  
                            }  
                        }  
 
                        count++;  
                    }  
                }  
                return columnsSearch;  
            }  
 
            //Function to build the Dynamic Column Names for linq query for the report  
            protected static string buildDynamicColumnNames(string dynamicColumns, List<string> columnsToDisplay)  
            {  
                //Building the Select statement parameters for linq query to be used for display of the columns for the report  
                for (int i = 0; i < columnsToDisplay.Count; i++)  
                {  
                    string col = columnsToDisplay[i];  
                    if (i == 0)  
                    {  
                        dynamicColumns = "new(" + col;  
                    }  
                    else 
                    {  
                        dynamicColumns += "," + col;  
                    }  
                    if (i == columnsToDisplay.Count - 1)  
                    {  
                        dynamicColumns += ")";  
                    }  
                }  
                return dynamicColumns;  
            }  
 
            //Function to retrieve the records /data to create the requested report by the yser  
            protected static object reportRecords(Type TEntity, IQueryable filteredResults)  
            {  
                //Define Type representing List of objects of T type  
                var genericType = typeof(List<>).MakeGenericType(TEntity);  
 
                //Create an object instance of defined type  
                var finalResults = Activator.CreateInstance(genericType);  
 
                //Get method Add from from the list  
                MethodInfo addMethod = finalResults.GetType().GetMethod("Add");  
 
                //Loop through the calling list  
                foreach (var item in filteredResults)  
                {  
                    //Convert each object of the list into T object by calling extension ToType<T>() and add this object to newly created list  
                    addMethod.Invoke(finalResults, new object[] { item.ToType(TEntity) });  
                }  
                return finalResults;  
            }
        #endregion 


Thanks in advance.
Payal
Payal Mandalia
Top achievements
Rank 1
 answered on 10 May 2010
3 answers
192 views

I have a RadGrid and am using the OnRowContextMenu="RowContextMenu".  I am trying to get the cellindex.  It works perfect for
GridBoundColumn but it comes back undefined for all the GridTemplateColumn. 

function RowContextMenu(sender, eventArgs) {

 var menu = $find("<%=RadMenu1.ClientID %>");
 var evt = eventArgs.get_domEvent();

 if (evt.target.tagName == "INPUT" || evt.target.tagName == "A") {
  return;
 }

 
 var index = eventArgs.get_itemIndexHierarchical();
 document.getElementById("radGridClickedRowIndex").value = index;

 var value = eventArgs.get_domEvent().target.innerHTML;
 document.getElementById("radGridClickedCellValue").value = value;

 var masterTable = sender.get_masterTableView();
 var cIndex = eventArgs.get_domEvent().target.cellIndex;
 var colName = masterTable.getColumnUniqueNameByCellIndex(getHeaderRow(sender), cIndex)
 document.getElementById("radGridClickedColName").value = colName;

 sender.get_masterTableView().selectItem(sender.get_masterTableView().get_dataItems()[index].get_element(), true);

 menu.show(evt);

 evt.cancelBubble = true;
 evt.returnValue = false;

 if (evt.stopPropagation) {
  evt.stopPropagation();
  evt.preventDefault();
 }

}

function getHeaderRow(sender) {
 var masterTable = sender.get_masterTableView();
        masterTable.HeaderRow == null ? sender.get_masterTableViewHeader().get_element() : masterTable.HeaderRow;
}

Any help is appreciated.  Thanks

 

David Simmonds
Top achievements
Rank 1
 answered on 09 May 2010
1 answer
75 views
Hi,
I have a user control (ucParent) and inside it I have another user control (ucChild) which after some action fires an event (ChildActionEvent) which is in turn received by ucParent to update some textbox. When I put ucParent on a normal page, the events fire correctly:
ucChild.RaiseEvent (ChildActionEvent)  -->> ucParent receives event. 

But when ucParent is used as the edit template for my grid, the event is "lost" and not captured by ucParent in the grid row (which is obviously in the edit mode).

Is there anything I have missed?

Please help.
Thank you very much.

ps. I'll be more than happy to provide the sample code if I should.
Safa Amini
Top achievements
Rank 1
 answered on 09 May 2010
2 answers
144 views
hello

i need to show text and an image in the header.
if i set the HeaderImageUrl only the picture is shown. i couldn't find a property or a thread so how can i avoid this behaviour or do i need a different approach at all?

best regards
Ibrahim Imam
Top achievements
Rank 1
 answered on 09 May 2010
2 answers
73 views
Hi Telerik team,

Currently, the EditAll command will turn every row regardless in MasterTable or DetailTable into editable form.

Could we implement a "Edit All" function that only apply for the rows in a chosen detail table?
I mean that each detail table has it own "Edit All" command button; and only rows in the detail table which its "Edit All" button is clicked turn in to editable form.

Thanks a lot.
Chelsea Leonhart
Top achievements
Rank 1
 answered on 09 May 2010
3 answers
177 views
Hi,

I am trying to use rotator in master page. The master page code is below:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!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>eReception</title>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .newsFeed
        {
            width: 100%;
            padding: 14px 0 0 20px;
            margin: 0 0 2px 0;
        }
    </style>        
</head>
<body style="background-image:url(Images/BodyVmn.gif);margin-bottom:0; margin-left:0; margin-right:0;margin-top:0;">
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" DecoratedControls="All" Skin="WebBlue" />
        <div style="text-align: center">
            <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                <tr>
                    <td rowspan="2" style="width: 65%; height: 100%; background-color: #003366; text-align: left;">
                        <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/vmn.jpg" Height="119px" Width="392px" /></td>
                    <td style="width: 35%; background-color: #003366; text-align: right;">
                        <span style="font-size: 24pt; color: #ffffff"><strong>
                            <asp:Image ID="Image2" runat="server" ImageUrl="../Images/jjl.jpg" />&nbsp;</strong></span></td>
                </tr>
                <tr>
                    <td style="width: 35%; background-color: #003366; text-align: right">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td align="right">
                                    <asp:Label ID="lblWelcome" runat="server" Visible="true" Text="Welcome Milind" CssClass="labelStyleSimpleBoldWhite" />&nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td align="right" style="height:8px">
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Button ID="btnLogOut" runat="server" Visible="true" Text="Sign Off" OnClick="btnLogOut_Click" />&nbsp;
                                </td>                                
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
        <div>
            <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; background-color:Black;">
                <tr>    
                    <td style="width:100%; height:4px; background-color:Silver;">
                    </td>
                </tr>
                <tr>
                    <td style="width:10%; height:25px;">
                        &nbsp;<asp:Label ID="lblNews" Text="News Headlines : " runat="server" CssClass="labelStyleSimpleBoldWhite" />
                    </td>
                    <td style="width:90%; height:45px;">
                        <telerik:RadRotator ID="RadRotator1" RotatorType="AutomaticAdvance" ScrollDirection="left" ScrollDuration="2000" runat="server" DataSourceID="xmlDataSource1"
                            Width="100%" Height="43px" FrameDuration="1" InitialItemIndex="-1">
                            <ItemTemplate>
                                <div class="newsFeed">
                                    <strong><a href='<%# XPath("link") %>'>
                                        <%# System.Web.HttpUtility.HtmlEncode(XPath("title").ToString())%>
                                    </a></strong>
                                </div>
                            </ItemTemplate>
                        </telerik:RadRotator>
                        <asp:XmlDataSource ID="xmlDataSource1" XPath="rss/channel/item" runat="server" DataFile="http://blogs.telerik.com/Blogs.rss">
                        </asp:XmlDataSource>    
                    </td>
                </tr>
                <tr>
                    <td style="width:100%; height:4px; background-color:Silver;">
                    </td>
                </tr>
            </table>
        </div>
        <div>
            <table border="0" cellpadding="0" cellspacing="0" style="width: 100%;">
                <tr>
                    <td style="width:100%; height:4px; background-color:silver;">
                    </td>
                </tr>
                <tr>
                    <td style="width:100%;">
                        <telerik:RadMenu ID="RadMenu1" runat="server" Skin="Web20" Width="100%">
                            <Items>
                                <telerik:RadMenuItem runat="server" Text="Root RadMenuItem1">
                                    <Items>
                                        <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 1">
                                        </telerik:RadMenuItem>
                                        <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 2">
                                        </telerik:RadMenuItem>
                                    </Items>
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem runat="server" Text="Root RadMenuItem2">
                                    <Items>
                                        <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 1">
                                        </telerik:RadMenuItem>
                                        <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 2">
                                        </telerik:RadMenuItem>
                                    </Items>
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem runat="server" Text="Root RadMenuItem3">
                                    <Items>
                                        <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 1">
                                        </telerik:RadMenuItem>
                                    </Items>
                                </telerik:RadMenuItem>
                            </Items>
                        </telerik:RadMenu>
                    </td>
                </tr>
                <tr>    
                    <td style="width:100%; height:4px; background-color:Silver;">
                    </td>
                </tr>
            </table>
        </div>
        <div>
            <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                <tr>
                    <td align="center" style="width:100%;  height:450px; vertical-align:top;">
                        <telerik:RadSplitter ID="RadSplitter1" runat="server" CssClass="Outlook" LiveResize="True" ResizeMode="EndPane" Width="100%" BackColor="Transparent" Height="500px">
                            <telerik:RadPane ID="RADContentPanel" runat="server" BackColor="Transparent" Width="99%">
                                <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
                                </asp:contentplaceholder>
                            </telerik:RadPane>
                            <telerik:RadSplitBar ID="RadSplitbar1" runat="server" CollapseMode="Backward" BackColor="Transparent" ></telerik:RadSplitBar>
                            <telerik:RadPane ID="RadMenuPane" runat="server" Scrolling="None" BackColor="Transparent" Width="1%">
                                <telerik:RadSlidingZone ID="RadSlidingZone1" runat="server" BackColor="Transparent" SlideDirection="Left">
                                    <telerik:RadSlidingPane ID="RadSlidingPane1" runat="server" Title="Notes" BackColor="Transparent" > </telerik:RadSlidingPane>  
                                    <telerik:RadSlidingPane ID="RadSlidingPane2" runat="server" Title="Circulars" BackColor="Transparent" > </telerik:RadSlidingPane>  
                                </telerik:RadSlidingZone>
                            </telerik:RadPane>
                        </telerik:RadSplitter>
                    </td>
                </tr>
            </table>        
        </div>
    </form>
</body>
</html>

Here I am using the RSS feed from telerik. When the page is loaded it simply shows nothing. If I use the same rotator code in a normal page it produces the result.

Can someone tell me is there any thing wrong with the way it is used in master page ?

Thanks & Regards,
-Milind Shevade
Rob
Top achievements
Rank 1
 answered on 08 May 2010
4 answers
353 views
Hello,

In my grid's edit form template, I have an asp:Panel control that has the "Visible=false" attribute.  I only want to show that section of the edit form template in certain cases.  It should not be displayed for every item that is in edit mode.

I'm having trouble programmatically getting a reference to my panel.  I've tried accessing it in the ItemCommand and PreRender events for the RadGrid, but every time I cannot obtain a reference to an instance of that object.

Can anyone give me a general idea of what method/event I should be attempting to do this from?  Does it sound like I'm doing something wrong?

Thank you,

Eric Skaggs
Bill
Top achievements
Rank 2
 answered on 08 May 2010
2 answers
110 views
Hey guys,

I'm trying to make the solution described at the link below to work with GridHyperLink columns. The problem I'm running into is if I create a class that inherits from GridHyperLinkColumn and do nothing at all to it (it's an empty class - not doing the stuff in the link below even), using that column in place of the out of the box GridHyperLinkColumn causes there to be no contents of the column showing up in the grid. You can test this easily by taking any hyperlink column thats working fine and changing it's tag to refer to your custom hyperlink class. I believe this may be a bug, and we need this fixed so we can implement drop down filters at the top of hyperlink columns.

http://www.telerik.com/help/aspnet-ajax/grdfilteringwithdropdownlist.html
Eric Means
Top achievements
Rank 1
 answered on 07 May 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?