Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
99 views

Ajax 2010.3.1317.45

as mentioned in this article,
http://www.telerik.com/help/aspnet-ajax/grdperformcalculationsingroupheader.html

I would like to have calculation (only group "count") on Any column being grouped. is there any way to accomplish this client-side, the reason for asking is that i use

 

 

 

GroupLoadMode="Client"

 


and dont want to set up groupfields for all columns, can i achieve this type of count aggrigation independent from what column is being grouped, maybe trough javascript?
Marin
Telerik team
 answered on 31 Mar 2011
2 answers
194 views
What I'm trying to do

I have an ASP.NET page which shows a list of items.  Once the page has loaded, I perform an AJAX call to go and get the stock for every item.  When the AJAX call returns, we then display an "in stock" or "out of stock" icon with an associated tooltip for each item.  The tooltip will display the actual stock.

The problem
The tooltip is not just text but has formatting in it.  I have got my code to work in Firefox 4, but it doesn't work in Internet Explorer 8.

The code
The tooltip text template is:

In stock - <span style='color: #ff0000;'>[[stock]]</span> items

When the page first loads, I have a hidden label (style display = none) and I set this label's text property to that of the template text.

When my AJAX call returns, it runs a function.  This function iterates through each item and performs the following:

tooltip.show();
tooltip.set_contentElement(inStockTextCached);
var content = tooltip.get_content().replace(""[[stock]]"", fields[" + QoHDisplay.QuantityOrdinal + @"]);
tooltip.set_content(content);
tooltip.hide();

Okay, a quick explanation of this JavaScript:

tooltip.show();
If I don't add this then I get an error if I attempt the next line.  The error is "this._contentCell is null" and the solution was posted here: http://www.telerik.com/community/forums/aspnet-ajax/tooltip/client-side-set-content-to-dom-element.aspx

tooltip.set_contentElement(inStockTextCached);
Earlier on in the function I create a reference "inStockTextCached" to the label that holds the template text.  I then set the tooltip's content element to be the same.

In Firefox 4 and Chrome, calling set_contentElement(inStockTextCached) works fine but in InternetExplorer it does not work.

var content = tooltip.get_content().replace(""[[stock]]"", fields[" + StockOrdinal + @"]);
Here, I load the content of the tooltip and "[[stock]]" with the actual stock value returned from the AJAX call.

tooltip.set_content(content);
I then attempt to update the content of the tooltip

tooltip.hide();
I had to show the tooltip to prevent the error, but ideally I don't want it to show when it first loads....this is my attempt to therefore hide it (but that doesn't seem to have the desired effect).


Any help would be much appreciated.

Thanks in advance

Griff


Svetlina Anati
Telerik team
 answered on 31 Mar 2011
6 answers
174 views
Hello,

I tried to ask a user to confirm a delete of a dock, but i can't do a confirmation because the dock have been removed from the zone before i get the command close from it.

How can i ask a confirmation on click the close icon of the dock?

Thanks,
Shimon
Pero
Telerik team
 answered on 31 Mar 2011
1 answer
90 views
please check the below attached image of grid.the problem  with item template columns,when there is no data the gird lines are not visible.this problem is in IE only not in Mozilla.i tried with gridlines property of grid also mastertableview too

anyone can help me to solve this problem please.

thank you
Princy
Top achievements
Rank 2
 answered on 31 Mar 2011
1 answer
119 views
I recently installed the update to 2011.1.315.40, and now find that RadRotator left and right buttons both show up on the left side of the RadRotator (see attached jpg). Before the update, in this project, the buttons were on the left and right sides as expected.

Has anyone else encountered this? Any ideas? Aspx for one of the pages follows:

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="textcontent">
        <h1>Exterior Pictures</h1>
        <div>
            <telerik:RadRotator ID="RadRotator1" runat="server" Height="363px"
                Style="margin-left: 60px" 
                ItemHeight="363px" ItemWidth="550px" RotatorType="SlideShowButtons" 
               Width="590px" Skin="Default">
                <SlideShowAnimation Duration="3000" Type="Fade" />
                <ItemTemplate>
                <asp:Image ID="Image1" runat="server" 
                        ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ImageUrl") %>'/>
            </ItemTemplate>
            </telerik:RadRotator>
        </div>
    </div>
</asp:Content>
Stanimir
Telerik team
 answered on 31 Mar 2011
3 answers
129 views
I have used RadWindow many times and have always been able to do a close and rebind. This time however things are a little different. To rebind the data to a radgrid I need to call a SQL stored procedure.

I have all the Javascript and Ajax code set just like the online example. This usually works. The typical Ajax Request Handler looks like:

Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
    If e.Argument = "Rebind" Then
        rgd_ABIUser.MasterTableView.SortExpressions.Clear()
        rgd_ABIUser.MasterTableView.GroupByExpressions.Clear()
        rgd_ABIUser.Rebind()
    ElseIf e.Argument = "RebindAndNavigate" Then
        rgd_ABIUser.MasterTableView.SortExpressions.Clear()
        rgd_ABIUser.MasterTableView.GroupByExpressions.Clear()
        rgd_ABIUser.MasterTableView.CurrentPageIndex = rgd_ABIUser.MasterTableView.PageCount - 1
        rgd_ABIUser.Rebind()
    End If
End Sub

This works when the radgrid is bound to a SQLDataSource. However, I need to rebind the grid using:

Private Function GetUser() As DataTable
    Dim DatabaseName As String = rcb_Database.SelectedValue
    Dim SC As String = rcb_Site.SelectedValue
    Dim connectionString = New SqlConnection("server=DO-IT-AB\MSSQLAB;database=AeriesAdmin;UID=XXXX;PWD=XXXX;")
    Dim command = New SqlCommand("aa_abi_users_by_site", connectionString)
    command.CommandType = CommandType.StoredProcedure
    command.Parameters.Add("@DBName", SqlDbType.VarChar).Value = DatabaseName
    command.Parameters.Add("@SC", SqlDbType.VarChar).Value = SC
    command.Connection.Open()
    Dim myDataAdapter As New SqlDataAdapter(command)
    Dim myDataSet As New DataSet
    Dim dtData As New DataTable
    myDataAdapter.Fill(myDataSet)
    Return myDataSet.Tables(0)
    command.Connection.Close()
End Function

I tried to modify the handler to call my function but this does not work:

Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
    If e.Argument = "Rebind" Then
        rgd_ABIUser.MasterTableView.SortExpressions.Clear()
        rgd_ABIUser.MasterTableView.GroupByExpressions.Clear()
        rgd_ABIUser.DataSource = GetUser()
        rgd_ABIUser.Rebind()
    ElseIf e.Argument = "RebindAndNavigate" Then
        rgd_ABIUser.MasterTableView.SortExpressions.Clear()
        rgd_ABIUser.MasterTableView.GroupByExpressions.Clear()
        rgd_ABIUser.MasterTableView.CurrentPageIndex = rgd_ABIUser.MasterTableView.PageCount - 1
        rgd_ABIUser.DataSource = GetUser()
        rgd_ABIUser.Rebind()
    End If
End Sub

Any help performing a RadWindow Close and Rebind.

Svetlina Anati
Telerik team
 answered on 31 Mar 2011
2 answers
174 views
I would like to remove the "Select All" checkbox from the header, and add an expand all button to the header above the "+" icons.  What is the best way to do this?  There doesn't seem to be a "header template" for this control.

Tsvetina
Telerik team
 answered on 31 Mar 2011
1 answer
258 views
Hello,

I have seen this topic in many different forum posts and demos on the site and I have tried so many different things I am just totally confused about how to make this work.

I have a RadGrid in which I am doing Inserts and Updates through an ObjectDataSource.  In the FormTemplate among other controls I have two dropdownlists that are both populated by their own ObjectDataSources.  The SelectParameter of the second dropdownlist is the selectedvalue from the first dropdownlist.  Before I converted this page into a RadGrid I simply used a ControlParameter for the ObjectDataSource of the second dropdownlist referencing the first one.  Now it seems that I can't do that within the FormTemplate of the grid for multiple reasons.

So what I need to accomplish is the following:

1.  I want the dropdowns to show the correct item as selected when that item is "edited".
2.  I want the second dropdown to be repopulated with the correct items when the first dropdown is changed.
3.  I want the correct item saved to the database on insert and update.

These are pretty obvious but at this point I'm not sure what I need to do to make that happen.

Here is the important snippet of my aspx code:

<FormTemplate>
    <asp:Panel ID="pnlEditPanel" runat="server" DefaultButton="btnUpdate" CssClass="edit_panel" TabIndex="100">
        <table border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td>Group:</td>
            <td>
                <asp:ObjectDataSource ID="odsGroupList" runat="server" SelectMethod="dsGroupList" TypeName="NUFOLibrary.CMembers">
                    <SelectParameters>
                        <asp:SessionParameter Name="sUserID" SessionField="UserID" Type="String" />
                        <asp:Parameter Name="sPublic" DefaultValue="0" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>        
                <asp:DropDownList ID="lstGroups" runat="server" DataSourceID="odsGroupList" DataTextField="Group" DataValueField="ID" AutoPostBack="True" AppendDataBoundItems="true" OnSelectedIndexChanged="lstGroups_SelectedIndexChanged" SelectedValue='<%# Bind("Group_ID") %>'>
                    <asp:ListItem Value="0" Text="(Select One)" />
                </asp:DropDownList>                                
            </td>
        </tr>  
        <tr>
            <td>Position:</td>
            <td>
                <asp:ObjectDataSource ID="odsPositionList" runat="server" SelectMethod="dsPositionList" TypeName="NUFOLibrary.CMembers">
                    <SelectParameters>
                        <asp:SessionParameter Name="sUserID" SessionField="UserID" Type="String" />
                        <asp:ControlParameter Name="sGroupID" ControlID="lstGroups" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>        
                <asp:DropDownList ID="lstPositions" runat="server" DataSourceID="odsPositionList" DataTextField="Position" DataValueField="ID" SelectedValue='<%# Bind("Position_ID") %>'>
                    <asp:ListItem Value="0" Text="(Select One)" />
                </asp:DropDownList>                                    
            </td>
        </tr>

So on an edit/update command this works.  It displays the correct item as selected in the second dropdownlist.  I am fine here because I actually set enable=false on an edit because they are not allowed to edit that field so I don't have to worry about changing the first dropdownlist and repopulating the second.

But the problem is on an insert.  When I try to add a new entry I immediately get an error that the second dropdownlist has a SelectedValue that is invalid because it doesn't exist in the list of items.

Maybe this is because I am setting the default empty value (or in my case 0)?

Here are the important parts of my codebehind:

Protected Sub gvMembers_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles gvMembers.ItemCommand
    If (e.CommandName = RadGrid.InitInsertCommandName) Then
        e.Canceled = True
        Dim newValues As System.Collections.Specialized.ListDictionary = New System.Collections.Specialized.ListDictionary()
        newValues("Group_ID") = "0"
        newValues("Facility_ID") = "0"
        newValues("Position_ID") = "0"
        e.Item.OwnerTableView.InsertItem(newValues)
    End If
End Sub
Private Sub gvMembers_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles gvMembers.ItemDataBound
    If e.Item.DataItem Is Nothing Then Exit Sub
    If "Membership".Equals(e.Item.OwnerTableView.Name) Then
        If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) Then
            Dim editFormItem As GridEditFormItem = CType(e.Item, GridEditFormItem)
            DirectCast(editFormItem.FindControl("lstGroups"), DropDownList).Enabled = False
            DirectCast(editFormItem.FindControl("lstFacilities"), DropDownList).Enabled = False
            DirectCast(editFormItem.FindControl("lstPositions"), DropDownList).Enabled = False
            DirectCast(editFormItem.FindControl("rdpStartDate"), RadDatePicker).Enabled = False
            DirectCast(editFormItem.FindControl("rdpEndDate"), RadDatePicker).Enabled = True
        End If
        If (TypeOf e.Item Is GridEditFormInsertItem) AndAlso (e.Item.OwnerTableView.IsItemInserted) Then
            Dim editFormItem As GridEditFormItem = CType(e.Item, GridEditFormItem)
            DirectCast(editFormItem.FindControl("lstGroups"), DropDownList).Enabled = True
            DirectCast(editFormItem.FindControl("lstFacilities"), DropDownList).Enabled = True
            DirectCast(editFormItem.FindControl("lstPositions"), DropDownList).Enabled = True
            DirectCast(editFormItem.FindControl("rdpStartDate"), RadDatePicker).Enabled = True
            DirectCast(editFormItem.FindControl("rdpEndDate"), RadDatePicker).Enabled = True
        End If
    End If
End Sub
Protected Sub lstGroups_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim lstGroups As DropDownList = DirectCast(sender, DropDownList)
    Dim editItem As GridEditFormItem = DirectCast(lstGroups.NamingContainer, GridEditFormItem)
    Dim lstFacilities As DropDownList = DirectCast(editItem.FindControl("lstFacilities"), DropDownList)
    Dim lstPositions As DropDownList = DirectCast(editItem.FindControl("lstPositions"), DropDownList)
    Dim rdpStartDate As RadDatePicker = DirectCast(editItem.FindControl("rdpStartDate"), RadDatePicker)
    Dim rdpEndDate As RadDatePicker = DirectCast(editItem.FindControl("rdpEndDate"), RadDatePicker)
    'Dim odsPositionList = New ObjectDataSource
    'odsPositionList.ID = "odsPositionList"
    'odsPositionList.SelectMethod = "dsPositionList"
    'odsPositionList.TypeName = "NUFOLibrary.CMembers"
    'odsPositionList.SelectParameters.Add(New Parameter("sUserID", TypeCode.String, HttpContext.Current.Session("UserID").ToString))
    'odsPositionList.SelectParameters.Add(New Parameter("sGroupID", TypeCode.String, lstGroups.SelectedValue))
    'lstPositions.DataSource = odsPositionList
    'lstPositions.DataBind()
    If lstGroups.SelectedValue = "3" Then
        lstFacilities.Enabled = False
    Else
        lstFacilities.Enabled = True
    End If
    If lstGroups.SelectedValue = "4" Then
        rdpStartDate.DbSelectedDate = ""
    Else
        rdpStartDate.DbSelectedDate = Now().ToString
    End If
    rdpEndDate.DbSelectedDate = ""
End Sub

I had tried moving the populating of the second dropdown to the SelectedIndexChanged of the first dropdownlist (as you see commented out) but that causes the problem that when it tries to save it doesn't save the item to the database because I had to remove the SelectedValue='<%# Bind("Position_ID") %>' for the aspx page because of another error.

Someone please help me to figure out the best way to accomplish this.  Do I need to do the entire thing in code including the insert/update tot he database instead of letting the grid do it?

thanks,

Steve
Mira
Telerik team
 answered on 31 Mar 2011
1 answer
68 views
I took the code to have a treeview in a combobox and it works fine. Problem is, I need it to do an autopostback when somebody changes the value. I have put autopostback=true for the combobox (there isn't one for the treeview) and it works when you first come in and there's no value for the text in the combo box. But once it's been set, it doesn't do the autopostback.

Any thoughts?

TIA - Jeff.
Shinu
Top achievements
Rank 2
 answered on 31 Mar 2011
1 answer
157 views
I'm creating a grid dynamically based on filters the user provides. The issue(s) I'm having are:
  1. The column filters no longer work. That is, selecting "Contains" or "StartsWith" doesn't work.
  2. When going to page 2 of the grid, all records are returned (looks like the grid is rebinding and is bringing back every record in the db instead of filters the dataset that's already contained in the grid)

Here's my aspx:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/RADMasterPage.master" AutoEventWireup="true" CodeFile="Report.aspx.cs" Inherits="Reporting_Report" Title="Untitled Page" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtoolkit" %>
<%@ Register src="../Controls/ReportFilters.ascx" tagname="ReportFilters" tagprefix="RF" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
 
    <script type="text/javascript">
        function requestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0) {
                args.set_enableAjax(false);
            }
        }
    </script>
</asp:Content>
<asp:Content ID="SectionHeader" ContentPlaceHolderID="cphSectionHeader" runat="server">
    <h3>Reporting</h3>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div>       
        <telerik:RadPanelBar ID="rpbFilters" Runat="server" Skin="Office2007"
            Width="100%" onitemclick="rpbFilters_ItemClick">
            <CollapseAnimation Type="Linear" Duration="200" />
            <ExpandAnimation Type="Linear" Duration="200" />
            <Items>
                <telerik:RadPanelItem Text="Report Filters" Expanded="true">
                    <Items>
                        <telerik:RadPanelItem Value="filters" runat="server">
                            <ItemTemplate>
                                <div>
                                    <RF:ReportFilters ID="rfFilters" runat="server" />
                                    <asp:Button ID="btnRunReport" runat="server" Text="Run Report" OnClick="RunReport" />
                                </div>
                            </ItemTemplate>
                        </telerik:RadPanelItem>
                    </Items>                   
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelBar>       
    </div>
    <asp:Panel ID="pnlGrid" runat="server" Visible="false">   
    <div id="wrapper">
        <telerik:radajaxmanager id="ramReport" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="rgReport">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="rgReport" LoadingPanelID="ralpReport" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:radajaxmanager>
        <telerik:radajaxloadingpanel
            enabled="true"
            id="ralpReport"           
            issticky="false"
            runat="server"
            skin=""
            transparency="50">
            <img id="imgLoader" src="../Images/loading3.gif" alt="Loading..." />
        </telerik:radajaxloadingpanel>
        <telerik:radajaxpanel
            clientevents-onrequeststart="requestStart"
            id="rapReport"
            loadingpanelid="ralpReport"
            runat="server">
             
            <telerik:RadGrid
                AllowFilteringByColumn="False"
                AllowPaging="True"
                AllowSorting="True"
                AutoGenerateColumns="False"
                DataSourceID="odsReports"
                EnableViewState="false"
                GridLines="None"
                ID="rgReport"
                OnExcelMLExportRowCreated="RadGrid1_ExcelMLExportRowCreated"
                OnExcelMLExportStylesCreated="RadGrid1_ExcelMLExportStylesCreated"
                runat="server"
                ShowFooter="True"
                ShowGroupPanel="True">
                 
                <ClientSettings
                    AllowColumnsReorder="true"
                    AllowDragToGroup="true"
                    ReorderColumnsOnClient="true">
                    <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True" />
                </ClientSettings>
                 
                <ExportSettings
                    ExportOnlyData="true"
                    IgnorePaging="true"
                    OpenInNewWindow="true">
                    <Excel Format="ExcelML" />
                </ExportSettings>
                 
                <FilterMenu
                    EnableImageSprites="False" />
                 
                <GroupingSettings
                    CaseSensitive="false"
                    ShowUnGroupButton="true" />
                 
                <HeaderContextMenu
                    CssClass="GridContextMenu GridContextMenu_Default" />               
                 
                <PagerStyle
                    Mode="NextPrevNumericAndAdvanced" />
            </telerik:RadGrid>
        </telerik:radajaxpanel>
    </div>
    <asp:ObjectDataSource ID="odsReports" runat="server"
            SelectMethod="GetReportResults"
            TypeName="Budco.StoreFront.Reporting.BLL.ReportResultset" OnObjectCreating="ObjectCreating">
    </asp:ObjectDataSource>
    </asp:Panel>
</asp:Content>

And here is my code behind:

using System;
using System.Data;
using System.Web.UI;
using Telerik.Web.UI;
using Budco.StoreFront.Reporting;
using Budco.StoreFront.Reporting.BLL;
using Budco.StoreFront.Common;
using Telerik.Web.UI.GridExcelBuilder;
using System.Web.UI.WebControls;
 
 
 
public partial class Reporting_Report : System.Web.UI.Page
{
    bool isConfigured = false;
    int filterDelay;
    int? _ReportID = null;
    string _ReportName = null;
    ReportResultset _ReportResultset = null;
    int? _ReportResultsID = null;
     
 
    protected void Page_Load(object sender, EventArgs e)
    {
        object oReportID = Request["ReportID"];
        object oReportName = Request["ReportName"];
        object oReportResultsID = Request["ReportResultsID"];
 
        if (oReportID != null)
        {
            _ReportID = Convert.ToInt32(oReportID);
            _ReportResultset = new ReportResultset((int)_ReportID);
        }
        if (_ReportID == null && oReportName != null)
        {
            _ReportName = oReportName.ToString();
            _ReportResultset = new ReportResultset(_ReportName);
        }
 
        if (oReportResultsID != null)
        {
            _ReportResultsID = Convert.ToInt32(oReportResultsID);
        }
 
 
        //if (!Page.IsPostBack)
        //{
            if (_ReportID != null || _ReportName != null)
            {
                GetParameterAttributes paramAttributes = new GetParameterAttributes();
                Reporting.GetParameterAttributesDataTable paramAttributesDT = paramAttributes.GetData(_ReportID);
                ASP.controls_reportfilters_ascx ctrl = (ASP.controls_reportfilters_ascx)rpbFilters.FindItemByValue("filters").FindControl("rfFilters");
                ctrl.BindControls(paramAttributesDT);
            }
        //}
        if (_ReportID != null || _ReportName != null)
        {
            //this.btnRunReport.Enabled = false;
        }
    }
 
 
    protected void RadGrid1_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e)
    {
        if (e.RowType == GridExportExcelMLRowType.DataRow)
        {
            //CellElement cell = e.Row.Cells.GetCellByName("Price");
            //cell.StyleValue = cell.StyleValue == "itemStyle" ? "priceItemStyle" : "alternatingPriceItemStyle";
        }
 
        if (e.RowType == Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowType.HeaderRow)
        {
            e.Worksheet.WorksheetOptions.PageSetup.PageHeaderElement.Data = "This is the header";
            e.Worksheet.WorksheetOptions.PageSetup.PageHeaderElement.Margin = 0.25;
            e.Worksheet.WorksheetOptions.PageSetup.PageFooterElement.Data = "This is the footer";
            e.Worksheet.WorksheetOptions.PageSetup.PageFooterElement.Margin = 0.25;
        }
 
        if (!isConfigured)
        {
            e.Worksheet.Name = "Test Agent Report";
 
            PageSetupElement pageSetup = e.Worksheet.WorksheetOptions.PageSetup;
            pageSetup.PageLayoutElement.IsCenteredVertical = true;
            pageSetup.PageLayoutElement.IsCenteredHorizontal = true;
            pageSetup.PageMarginsElement.Left = 0.75;
            pageSetup.PageMarginsElement.Top = 0.5;
            pageSetup.PageMarginsElement.Right = 0.5;
            pageSetup.PageMarginsElement.Bottom = 0.75;
            pageSetup.PageLayoutElement.PageOrientation = PageOrientationType.Landscape;
 
            e.Worksheet.WorksheetOptions.AllowFreezePanes = true;
            e.Worksheet.WorksheetOptions.LeftColumnRightPaneNumber = 1;
            e.Worksheet.WorksheetOptions.TopRowBottomPaneNumber = 1;
            e.Worksheet.WorksheetOptions.SplitHorizontalOffset = 1;
            e.Worksheet.WorksheetOptions.SplitVerticalOffest = 1;
 
            e.Worksheet.WorksheetOptions.ActivePane = 2;
            isConfigured = true;
        }
    }
 
 
    protected void RadGrid1_ExcelMLExportStylesCreated(object source, GridExportExcelMLStyleCreatedArgs e)
    {
        StyleElement priceStyle = new StyleElement("priceItemStyle");
        priceStyle.NumberFormat.FormatType = NumberFormatType.Currency;
        priceStyle.FontStyle.Color = System.Drawing.Color.Red;
        e.Styles.Add(priceStyle);
 
        StyleElement alternatingPriceStyle = new StyleElement("alternatingPriceItemStyle");
        alternatingPriceStyle.NumberFormat.FormatType = NumberFormatType.Currency;
        alternatingPriceStyle.FontStyle.Color = System.Drawing.Color.Red;
        e.Styles.Add(alternatingPriceStyle);
 
        foreach (StyleElement style in e.Styles)
        {
            switch (style.Id)
            {
                case "itemStyle": style.FontStyle.Color = System.Drawing.Color.Green; break;
            }
        }
    }
 
    protected void RunReport(object sender, EventArgs e)
    {
        if (_ReportID != null || _ReportName != null)
        {
            ASP.controls_reportfilters_ascx ctrl = (ASP.controls_reportfilters_ascx)rpbFilters.FindItemByValue("filters").FindControl("rfFilters");
            Panel pnl = (Panel)ctrl.FindControl("pnlFilters");
            if (pnl.HasControls())
            {
                //GetParameterAttributes paramAttributes = new GetParameterAttributes();
                //Reporting.GetParameterAttributesDataTable paramAttributesDT = paramAttributes.GetData(_ReportID);
                _ReportResultset.ParameterValues.Clear();
                 
                foreach (Control control in pnl.Controls)
                {
                    string theControl = control.GetType().ToString();
                    switch (control.GetType().ToString())
                    {
                        case "System.Web.UI.WebControls.TextBox":
                            _ReportResultset.ParameterValues.Add(new Budco.StoreFront.Common.Parameter(control.ID.Substring(3), ((TextBox)control).Text));
                            break;
                    }
                }
            }
 
            // Get ReportResults & ReportResultsColumn data
            ReportResults rptResults = new ReportResults();
            //ReportResultsColumn rptResultsColumn = new ReportResultsColumn();
            GetReportResultsColumns rptResultsColumn = new GetReportResultsColumns();
            Reporting.ReportResultsDataTable resultsDT = rptResults.GetData(this._ReportResultsID, _ReportID);
            Reporting.GetReportResultsColumnsDataTable resultsColumnDT = rptResultsColumn.GetData(null, resultsDT.Rows[0]["ResultsName"].ToString());
 
            // Set RadGrid level properties
            rgReport.Skin = "Office2007"; //resultsDT.Rows[0]["Skin"].ToString();
            rgReport.HeaderStyle.CssClass = resultsDT.Rows[0]["HeaderStyleCssClass"].ToString();
            rgReport.ItemStyle.CssClass = resultsDT.Rows[0]["ItemStyleCssClass"].ToString();
            rgReport.FooterStyle.CssClass = resultsDT.Rows[0]["FooterStyleCssClass"].ToString();
 
            // Set MasterTableView level properties
            rgReport.MasterTableView.CommandItemSettings.ShowExportToCsvButton = (bool)resultsDT.Rows[0]["ShowExportToCsvButton"];
            rgReport.MasterTableView.CommandItemSettings.ShowExportToExcelButton = (bool)resultsDT.Rows[0]["ShowExportToExcelButton"];
            rgReport.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false;
            rgReport.MasterTableView.AllowFilteringByColumn = true;
            rgReport.MasterTableView.AutoGenerateColumns = false;
            rgReport.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.TopAndBottom;
            rgReport.MasterTableView.ShowFooter = true;
            rgReport.MasterTableView.TableLayout = GridTableLayout.Auto;
            this.rgReport.MasterTableView.Columns.Clear(); // this prevents duplicate columns which causes an error
 
            foreach (DataRow row in resultsColumnDT.Rows)
            {
                switch (row["ColumnTypeName"].ToString())
                {
                    case "Telerik.Web.UI.GridBoundColumn":
                        GridBoundColumn boundColumn = new GridBoundColumn();
                        this.rgReport.MasterTableView.Columns.Add(boundColumn);
 
                        boundColumn.AllowFiltering = (bool)row["AllowFiltering"];
                        boundColumn.AllowSorting = (bool)row["AllowSorting"];
                        boundColumn.AutoPostBackOnFilter = (bool)row["AutoPostBackOnFilter"];
                        boundColumn.DataField = row["DataField"].ToString();
                        boundColumn.DataFormatString = row["DataFormatString"].ToString();
                        boundColumn.FilterControlAltText = row["FilterControlAltText"].ToString();
                        bool result = Int32.TryParse(row["FilterDelay"].ToString(), out filterDelay);
                        boundColumn.FilterDelay = filterDelay;
                        boundColumn.HeaderText = row["HeaderText"].ToString();
                        boundColumn.SortExpression = row["DataField"].ToString();
                        boundColumn.UniqueName = row["DataField"].ToString();
                        break;
 
                    case "Telerik.Web.UI.GridDateTimeColumn":
                        GridDateTimeColumn dateTimeColumn = new GridDateTimeColumn();
                        this.rgReport.MasterTableView.Columns.Add(dateTimeColumn);
 
                        dateTimeColumn.AllowFiltering = (bool)row["AllowFiltering"];
                        dateTimeColumn.AllowSorting = (bool)row["AllowSorting"];
                        dateTimeColumn.AutoPostBackOnFilter = (bool)row["AutoPostBackOnFilter"];
                        dateTimeColumn.DataField = row["DataField"].ToString();
                        dateTimeColumn.DataFormatString = row["DataFormatString"].ToString();
                        dateTimeColumn.DataType = System.Type.GetType(row["DataType"].ToString());
                        dateTimeColumn.FilterControlAltText = row["FilterControlAltText"].ToString();
                        bool result2 = Int32.TryParse(row["FilterDelay"].ToString(), out filterDelay);
                        dateTimeColumn.FilterDelay = filterDelay;
                        dateTimeColumn.HeaderText = row["HeaderText"].ToString();
                        dateTimeColumn.PickerType = GridDateTimeColumnPickerType.DatePicker;
                        dateTimeColumn.SortExpression = row["DataField"].ToString();
                        dateTimeColumn.UniqueName = row["DataField"].ToString();
                        break;
 
                    case "Telerik.Web.UI.GridNumericColumn":
                        GridNumericColumn numericColumn = new GridNumericColumn();
                        this.rgReport.MasterTableView.Columns.Add(numericColumn);
 
                        foreach (GridAggregateFunction gaf in Enum.GetValues(typeof(GridAggregateFunction)))
                        {
                            if (gaf.ToString().Equals(row["Aggregate"].ToString()))
                            {
                                numericColumn.Aggregate = gaf;
                                break;
                            }
                        }
                        numericColumn.AllowFiltering = (bool)row["AllowFiltering"];
                        numericColumn.AllowSorting = (bool)row["AllowSorting"];
                        numericColumn.AutoPostBackOnFilter = (bool)row["AutoPostBackOnFilter"];
                        numericColumn.DataField = row["DataField"].ToString();
                        numericColumn.DataFormatString = row["DataFormatString"].ToString();
                        numericColumn.DataType = System.Type.GetType(row["DataType"].ToString());
                        numericColumn.FilterControlAltText = row["FilterControlAltText"].ToString();
                        bool result3 = Int32.TryParse(row["FilterDelay"].ToString(), out filterDelay);
                        numericColumn.FilterDelay = filterDelay;
                        numericColumn.FooterAggregateFormatString = row["FooterAggregateFormatString"].ToString();
                        numericColumn.HeaderText = row["HeaderText"].ToString();
                        numericColumn.SortExpression = row["DataField"].ToString();
                        numericColumn.UniqueName = row["DataField"].ToString();
                        break;
 
                    default:
                        break;
                }
 
            }
 
            rgReport.Rebind(); // this causes the grid to bring back every record from the db.
            pnlGrid.Visible = true;
        }
    }
    protected void rpbFilters_ItemClick(object sender, RadPanelBarEventArgs e)
    {
         
    }
 
 
    protected void ObjectCreating(object sender, ObjectDataSourceEventArgs e)
    {
        if (_ReportID != null || _ReportName != null)
        {
            //_ReportResultset = new ReportResultset((int)_ReportID);
            e.ObjectInstance = _ReportResultset;
        }
    }
}


What am I doing wrong here?

Thanks,
Mark
Mira
Telerik team
 answered on 31 Mar 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?