This is a migrated thread and some comments may be shown as answers.

Export RadGrid is not working!

3 Answers 208 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Atman
Top achievements
Rank 1
Atman asked on 29 Apr 2011, 03:57 AM

Hi,

 

I was developing application using Telerik ASP.Net controls (Version: 2011.1.315.40). My Page have hierarchical grid with export functionality. Export functionality was working properly before. As we added more features it stop working.
Even After going through forums and knowledge base article I am not able to resolve this error. Here I am sending you few pages of application. Please help me to figure out problem why export is not working.

 

 

Details of Application:

 

Application contains master page with RadAjaxManager & ScriptManager. Each control contains RadAjaxManagerProxy to overcome limitation of multiple RadAjaxManager not allowed on same page.

-          -MyDashboard Page is container page with various control hosted within page.

-          - MyIssueControl hosted within MyDashboard Page. This control contains hierarchical grid. I am just exporting Top Grid (IssueGrid) with default export functionality.

-         - MyIssueControl hosts other controls as well.

-          -After clicking on default export functionality it doesn’t do anything. It throws scripting error(ScriptError.jpg).

-          -After going through forums which advise to register RadAjaxManager events in Control to execute client side code which is not possible using RadAjaxManagerProxy.

-          After registering RadAjaxManager event in MyIssueControl to execute function OnRequestStart which will disable Ajax for exporting functionality (as it required for export explain in help documents) its now throwing new error (Error.jpg)

 

Note:  Application will not work as it requires data from db. This application pages are just for reference to figure out issue.  Please check attach zip file for error screen shot as well as application pages.

 

 

This is very critical project issue. Please help me to resolve ASAP. Thanks for your help.

Thanks,
Atman


MyIssuecontrol.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyIssuesControl.ascx.cs" Inherits="Controls_MyIssuesControl" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Charting" TagPrefix="telerik" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register src="IssueDefinationControl.ascx" TagName="IssueDefination" TagPrefix="UC"  %>
<%@ Register src="MyActionsControl.ascx" TagName="Action" TagPrefix="UC"  %>
 
<style type="text/css">
    .viewWrap
    {
        padding: 15px;
        background: #2291b5 0 0 url(Img/bluegradient.gif) repeat-x;
    }
    .contactWrap
    {
        padding: 10px 15px 15px 15px;
        background: #fff;
        color: #333;
    }
     
    .contactWrap td
    {
        padding: 0 20px 0 0;
    }
     
    .contactWrap td td
    {
        padding: 3px 20px 3px 0;
    }
     
    .contactWrap img
    {
        border: 1px solid #05679d;
    }
     
    .InnerHeaderStyle
    {
        background: navy !important;
        font-size: 13px !important;
        color: white !important; /*add more style definitions here*/
    }
    .InnerItemStyle
    {
        background: orange !important;
        color: brown !important; /*add more style definitions here*/
    }
    .InnerAlernatingItemStyle
    {
        background: white !important;
        color: brown !important; /*add more style definitions here*/
    }
    .MostInnerHeaderStyle
    {
        background: brown !important;
        font-size: 15px !important;
        color: white !important; /*add more style definitions here*/
    }
    .MostInnerItemStyle
    {
        background: white !important;
        color: olive !important; /*add more style definitions here*/
    }
    .MostInnerAlernatingItemStyle
    {
        background: olive !important;
        color: white !important; /*add more style definitions here*/
    }
</style>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function RowDblClick(sender, eventArgs) {
            sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
        }
        function onRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
                args.set_enableAjax(false);
            }
        }
        var popUp;
        function PopUpShowing(sender, eventArgs) {
            popUp = eventArgs.get_popUp();
            var gridWidth = sender.get_element().offsetWidth;
            var gridHeight = sender.get_element().offsetHeight;
            var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px"));
            var popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px"));
            popUp.style.left = ((gridWidth - popUpWidth) / 2 + sender.get_element().offsetLeft).toString() + "px";
            popUp.style.top = ((gridHeight - popUpHeight) / 2 + sender.get_element().offsetTop).toString() + "px";
        }
 
        function OpenPositionedWindow(oButton, url, windowName) {
            var oWnd = window.radopen(url, windowName);
        }
 
        function openRadWindow(Type, ID) {
            var oWnd = radopen("AttachFile.aspx?Type=" + Type + "&TypeID=" + ID, "File Attachment");
             
            oWnd.center();
        }
 
        function ValidateTextBox(oSrc, args) {
           // alert("here");
           // alert(args.Value);
            args.IsValid = (args.Value != '');
            if (!args.IsValid) {
                alert(args.toString());
            }
        }
    </script>
</telerik:RadCodeBlock>
<table width="98%" style="vertical-align: top">
    <tr>
        <td valign="top">
            <!-- content start -->
             <telerik:RadAjaxManagerProxy ID="AjaxManagerProxy" runat="server">
               <AjaxSettings>
                   <telerik:AjaxSetting AjaxControlID="IssueGrid">
                       <UpdatedControls>
                           <telerik:AjaxUpdatedControl ControlID="IssueGrid" LoadingPanelID="IssueGridLoadingPanel" />
                       </UpdatedControls>
                   </telerik:AjaxSetting>
               </AjaxSettings>
            </telerik:RadAjaxManagerProxy>
            <telerik:RadAjaxLoadingPanel ID="IssueGridLoadingPanel" runat="server"  />
            <telerik:RadWindowManager ID="RadWindowManager1" Width="850px" Height="600px" runat="server" VisibleStatusbar="false" Modal="true" Behaviors="Close,Move">
            </telerik:RadWindowManager>
 
            <telerik:RadGrid ID="IssueGrid" OnPreRender="IssueGrid_PreRender" OnNeedDataSource="IssueGrid_NeedDataSource"
                runat="server" AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" 
                PageSize="15" GridLines="none" ShowGroupPanel="false" OnItemCreated="IssueGrid_ItemCreated"
                OnItemDataBound="IssueGrid_ItemDataBound" OnItemCommand="IssueGrid_ItemCommand"
                ShowStatusBar="true" AllowMultiRowEdit="true" OnInsertCommand="IssueGrid_InsertCommand" OnUpdateCommand="IssueGrid_UpdateCommand"
                AllowAutomaticDeletes="false" AllowAutomaticInserts="false" AllowAutomaticUpdates="false"
                AllowMultiRowSelection="True" AllowFilteringByColumn="false" CssClass="RadGrid">
                <PagerStyle Mode="NumericPages"></PagerStyle>
                <ClientSettings AllowDragToGroup="false">
                    <ClientEvents OnPopUpShowing="PopUpShowing"  />
                    <Selecting AllowRowSelect="true" />
                </ClientSettings>
                <ExportSettings HideStructureColumns="true" ExportOnlyData="true" IgnorePaging="true"
                    Excel-FileExtension="xlsx" Csv-FileExtension=".csv" OpenInNewWindow="true" />
                <MasterTableView Name="IssueList" DataKeyNames="IssueNo" AllowMultiColumnSorting="True"
                    GroupLoadMode="Server" AllowFilteringByColumn="true" EditMode="PopUp"
                    CommandItemDisplay="TopAndBottom">
                    <EditFormSettings InsertCaption="Add New Issue" CaptionFormatString="Edit Issue No: {0}"
                        CaptionDataField="IssueNo" PopUpSettings-Modal="false" PopUpSettings-ScrollBars="Auto"
                        PopUpSettings-Height="400px" PopUpSettings-Width="750px" />
                    <CommandItemSettings AddNewRecordText="Add New Issue" ShowExportToWordButton="false"
                        ShowExportToExcelButton="true" ShowExportToCsvButton="true" ShowExportToPdfButton="false" />
                    <NoRecordsTemplate>
                        <div>
                            There are no Issue records to display.
                        </div>
                    </NoRecordsTemplate>
                    <NestedViewTemplate>
                        <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false"
                            BackColor="AliceBlue">
                            <telerik:RadTabStrip runat="server" ID="CLCATab" MultiPageID="CLCAMultiPage" SelectedIndex="0"
                                Skin="Outlook">
                                <Tabs>
                                    <telerik:RadTab runat="server" Text="<u>D</u>efination" AccessKey="D" PageViewID="IssueDefinationView">
                                    </telerik:RadTab>
                                    <telerik:RadTab runat="server" Text="<u>I</u>solation" AccessKey="I" PageViewID="IsolationView">
                                    </telerik:RadTab>
                                    <telerik:RadTab runat="server" Text="<u>R</u>oot Cause" AccessKey="R" PageViewID="RootCauseView">
                                    </telerik:RadTab>
                                    <telerik:RadTab runat="server" Text="<u>C</u>orrective Action" AccessKey="C" PageViewID="CAPAView">
                                    </telerik:RadTab>
                                    <telerik:RadTab runat="server" Text="C<u>l</u>osure" AccessKey="L" PageViewID="ClosureView">
                                    </telerik:RadTab>
                                    <telerik:RadTab runat="server" Text="Con<u>t</u>ainment" AccessKey="T" PageViewID="ContaintmentView">
                                    </telerik:RadTab>
                                </Tabs>
                            </telerik:RadTabStrip>
                            <telerik:RadMultiPage runat="server" ID="CLCAMultiPage" SelectedIndex="0" RenderSelectedPageOnly="false">
                                <asp:Label ID="lblIssueNo" Font-Bold="true" Font-Italic="true" Text='<%# Eval("IssueNo") %>' Visible="false" runat="server" />
                                <telerik:RadPageView runat="server" ID="IssueDefinationView">
                                    <UC:IssueDefination runat="server" ID="ctrlIssueDefination" ActionType="Defination" />
                                </telerik:RadPageView>
                                <telerik:RadPageView runat="server" ID="IsolationView">
                                    <UC:Action runat="server" ID="ctrlIsolationAction" ActionType="Isolation"  />
                                </telerik:RadPageView>
                                <telerik:RadPageView runat="server" ID="RootCauseView">
                                    <UC:Action runat="server" ID="ctrlRootCauseAction" ActionType="RootCause"  />
                                </telerik:RadPageView>
                                <telerik:RadPageView runat="server" ID="CAPAView">
                                    <UC:Action runat="server" ID="ctrlCAPAAction" ActionType="CorrectiveAction"  />
                                </telerik:RadPageView>
                                <telerik:RadPageView runat="server" ID="ClosureView">
                                    <UC:Action runat="server" ID="ctrlClosureAction" ActionType="ClosureAction" />
                                </telerik:RadPageView>
                                <telerik:RadPageView runat="server" ID="ContaintmentView">
                                    <UC:Action runat="server" ID="ctrlContaintmentAction" ActionType="ContaintmentAction"  />
                                </telerik:RadPageView>
                            </telerik:RadMultiPage>
                        </asp:Panel>
                    </NestedViewTemplate>
                    <Columns>
                        <telerik:GridEditCommandColumn ItemStyle-Width="5%" UniqueName="EditCommandColumn"
                         ItemStyle-VerticalAlign="Top" ButtonType="LinkButton">
                        </telerik:GridEditCommandColumn>
                        <telerik:GridBoundColumn DataField="IssueNo"  HeaderText="Issue No"  SortExpression="IssueNo"  HeaderButtonType="TextButton"
                            ItemStyle-Width="8%" ItemStyle-VerticalAlign="Top"
                            CurrentFilterFunction="EqualTo" FilterControlWidth="70px" ReadOnly="true">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Issue"  HeaderText="Issue" SortExpression="Issue" HeaderButtonType="TextButton"
                             ItemStyle-Width="8%" ItemStyle-VerticalAlign="Top"
                             CurrentFilterFunction="EqualTo" >
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="IssueSummary" HeaderText="Summary"  SortExpression="IssueSummary" HeaderButtonType="TextButton"
                          ItemStyle-Width="15%"  ItemStyle-VerticalAlign="Top"
                          CurrentFilterFunction="Contains">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn  DataField="IssueDescription"  SortExpression="IssueDescription" HeaderText="Description" HeaderButtonType="TextButton"
                            ItemStyle-Width="23%"  ItemStyle-VerticalAlign="Top"
                            FilterControlWidth="150px" CurrentFilterFunction="Contains">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="IssueStatus" HeaderText="Status" SortExpression="IssueStatus"  HeaderButtonType="TextButton"
                            ItemStyle-Width="8%" ItemStyle-VerticalAlign="Top"
                            CurrentFilterFunction="EqualTo">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="IssueOwner" HeaderText="Owner"  SortExpression="IssueOwner"  HeaderButtonType="TextButton"
                            ItemStyle-Width="8%" ItemStyle-VerticalAlign="Top"
                            CurrentFilterFunction="EqualTo">
                        </telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="IssueCreateDate"  HeaderText="Issue Create Date"  PickerType="DatePicker" SortExpression="IssueCreateDate"  DataFormatString="{0:MM/dd/yyyy}" HeaderButtonType="TextButton"
                            ItemStyle-Width="12%" ItemStyle-VerticalAlign="Top">
                        </telerik:GridDateTimeColumn>
                        <telerik:GridDateTimeColumn DataField="UpdateDate" HeaderText="Last Updated On"  PickerType="DatePicker"   SortExpression="UpdateDate" DataFormatString="{0:MM/dd/yyyy}" HeaderButtonType="TextButton" 
                             ItemStyle-Width="18%" ItemStyle-VerticalAlign="Top">
                        </telerik:GridDateTimeColumn>
                        <telerik:GridBoundColumn  DataField="IssueReference" UniqueName="IssueReference" SortExpression="IssueReference" HeaderText="Reference No#" HeaderButtonType="TextButton"
                            ItemStyle-Width="13%" ItemStyle-VerticalAlign="Top"
                            CurrentFilterFunction="Contains">
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn>
                            <ItemTemplate>
                                <a href="#" onclick="openRadWindow('Issue','<%# DataBinder.Eval(Container.DataItem, "IssueNo") %>');return false;">
                                     <img src="~/Images/app/attachment_icon.png" runat="server" enableviewstate="false" alt="Attachments" border="0" />
                                </a>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                    <EditFormSettings EditFormType="Template" >
                        <FormTemplate>
                            <table cellspacing="0" cellpadding="4" width="100%" border="0" style="background: white;">
                                <tr valign="top">
                                    <td align="center" valign="top" style="width: 95%;">
                                        <table id="TableIssue" cellspacing="1" cellpadding="1" width="100%" border="0"
                                            style="height: 320px;  background: white;">
                                            <tr class="EditFormHeader" valign="top">
                                                <td colspan="4">
                                                     
                                                </td>
                                            </tr>
                                            <tr class="EditFormHeader" valign="top">
                                                <td align="right" class="editFormRow" style="width: 18%">
                                                    Issue :
                                                </td>
                                                <td class="editFormRow" style="width: 20%" align="left" >
                                                    <asp:Label ID="lblIssueType" runat="server" Visible="false"  Text='<%# Bind("Issue") %>'></asp:Label>
                                                    <asp:DropDownList ID="ddIssueType" runat="server" DataValueField="IssueType" DataTextField="IssueType"
                                                        Width="180px" AppendDataBoundItems="True" Style="z-index: 1;">
                                                        <asp:ListItem Selected="True" Text="--Select Process Triggering Issue--" Value=""></asp:ListItem>
                                                    </asp:DropDownList>
                                                    <asp:RequiredFieldValidator  ID="IssueTypeRequired" runat="server" ControlToValidate="ddIssueType"
                                                    CssClass="failureNotification"  ErrorMessage="*" ToolTip="Triggering Issue is required."  ValidationGroup="IssueValidationGroup"
                                                     ></asp:RequiredFieldValidator >
                                                </td>
                                                <td align="right" class="editFormRow" style="width: 18%">
                                                    Issue Owner :
                                                </td>
                                                <td class="editFormRow" style="width: 44%">
                                                    <asp:DropDownList ID="ddIssueOwner" runat="server" DataValueField="UserName" DataTextField="Name"
                                                        Width="200PX" AppendDataBoundItems="True" Style="z-index: 1;">
                                                        <asp:ListItem Selected="True" Text="--Select Issue Owner--" Value=""></asp:ListItem>
                                                    </asp:DropDownList>
                                                    <span style="color: Red">*</span>
                                                    
                                                    <asp:RequiredFieldValidator ID="IssueOwnerRequired" runat="server" ControlToValidate="ddIssueOwner"
                                                    CssClass="failureNotification" ErrorMessage="Issue Owner is required."  ToolTip="Issue Owner is required."
                                                    ValidationGroup="IssueValidationGroup"  ></asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr valign="top">
                                                <td class="editFormRow" align="right" style="width: 18%">
                                                    Issue Summary :
                                                </td>
                                                <td colspan="3" class="editFormRow" align="left" style="width: 82%">
                                                    <asp:TextBox ID="txtIssueSummary" runat="server" Width="450px" Text='<%# Bind("IssueSummary") %>'></asp:TextBox>
                                                    <span style="color: Red">*</span>
                                                    <asp:RequiredFieldValidator  ID="txtIssueSummaryRequired" runat="server" ControlToValidate="txtIssueSummary"
                                                    CssClass="failureNotification"  ErrorMessage="*" ToolTip="Issue Summary is required."   ValidationGroup="IssueValidationGroup"
                                                     ></asp:RequiredFieldValidator >
                                                </td>
                                            </tr>
                                            <tr valign="top">
                                                <td class="editFormRow" align="right" style="width: 18%">
                                                    Issue Descriptioin :
                                                </td>
                                                <td colspan="3" class="editFormRow" align="left" style="width: 82%;">
                                                    <asp:TextBox ID="txtIssueDescription" runat="server" TextMode="MultiLine" Width="450px"
                                                        Height="150px" Text='<%# Bind("IssueDescription") %>'></asp:TextBox>
                                                    <span style="color: Red">*</span><asp:RequiredFieldValidator ID="txtIssueDescriptionRequired" runat="server" ControlToValidate="txtIssueDescription"
                                                    CssClass="failureNotification" ErrorMessage="Issue Description is required." ToolTip="Issue Description is required."
                                                    ValidationGroup="IssueValidationGroup" ></asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr valign="top">
                                                <td class="editFormRow" align="right" style="width: 18%">
                                                    Reference No # :
                                                </td>
                                                <td colspan="3" class="editFormRow" align="left" style="width: 82%">
                                                    <asp:TextBox ID="txtIssueReference" runat="server" Width="450px" Text='<%# Bind("IssueReference") %>'></asp:TextBox>
                                                </td>
                                            </tr>
                                           
                                            <tr valign="top">
                                                <td colspan="1">
                                                      
                                                </td>
                                                <td colspan="3" align="left">
                                                    <asp:Button ID="btnSave" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'
                                                        CssClass="actionButton" ValidationGroup="IssueValidationGroup"></asp:Button>  
                                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                        CommandName="Cancel" CssClass="actionButton"></asp:Button>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </FormTemplate>
                    </EditFormSettings>
                </MasterTableView>
            </telerik:RadGrid>
        </td>
     </tr>
</table>


MyIssuecontrol.ascx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Diagnostics;
using Telerik.Web.UI;
using CLCA.BusinessLogic;
using System.Collections;
 
 
public partial class Controls_MyIssuesControl : System.Web.UI.UserControl
{
    #region Property & Variables
    IssueManager objIssueManager;
    LookupManager objLookupManager;
 
    public IssueManager ObjIssueManager
    {
        get
        {
            // Init the objIssueManager
            if (this.objIssueManager == null)
                this.objIssueManager = new IssueManager();
            return this.objIssueManager;
        }
    }
    public LookupManager ObjLookupManager
    {
        get
        {
            // Init the objLookupManager
            if (this.objLookupManager == null)
                this.objLookupManager = new LookupManager();
            return this.objLookupManager;
        }
    }
    #endregion
 
    #region User Control Events
    protected void Page_Init(object sender, EventArgs e)
    {
        this.objIssueManager = new IssueManager();
        this.objLookupManager = new LookupManager();
    }
 
    protected void Page_Load(object sender, EventArgs e)
    {
        RadAjaxManager manager = RadAjaxManager.GetCurrent(Page);
        manager.ClientEvents.OnRequestStart = "onRequestStart";
    }
 
    #endregion
 
    #region Issue Grid Events
    protected void IssueGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        DataTable issueData = new DataTable();
        try
        {
            issueData = GetIssueData(string.Empty);
        }
        catch (Exception ex)
        {
            ObjIssueManager.LogMessage(ex.Message + Environment.NewLine + ex.InnerException, Severity.FatalError.ToString(), ex.Source, Layer.UserInterface.ToString());
        }
        
        IssueGrid.DataSource = issueData;
         
    }
 
    protected void IssueGrid_PreRender(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            IssueGrid.Rebind();
            //IssueGrid.MasterTableView.Items[0].Expanded = false;
            //IssueGrid.MasterTableView.Items[0].ChildItem.FindControl("InnerContainer").Visible = false;
        }
    }
 
    protected void IssueGrid_ItemCommand(object source, GridCommandEventArgs e)
    {
        int issueNo = 0;
        string issueOwner = string.Empty;
 
        if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item is GridDataItem)
        {
            foreach (GridItem item in e.Item.OwnerTableView.Items)
            {
                if (item.Expanded && item != e.Item)
                {
                    item.Expanded = false;
                }
            }
 
            ((GridDataItem)e.Item).ChildItem.FindControl("InnerContainer").Visible =
                !e.Item.Expanded;
 
            if (!e.Item.Expanded)
            {
                try
                {
                    GridDataItem gridItem = e.Item as GridDataItem;
                    issueOwner = gridItem["IssueOwner"].Text;
                    issueNo = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["IssueNo"].ToString());// gridItem["IssueNo"].Text;
 
                    Control ctrlIssueDefination = ((GridDataItem)e.Item).ChildItem.FindControl("ctrlIssueDefination");
                    Control ctrlIsolationAction = ((GridDataItem)e.Item).ChildItem.FindControl("ctrlIsolationAction");
                    Control ctrlRootCauseAction = ((GridDataItem)e.Item).ChildItem.FindControl("ctrlRootCauseAction");
                    Control ctrlCAPAAction = ((GridDataItem)e.Item).ChildItem.FindControl("ctrlCAPAAction");
                    Control ctrlClosureAction = ((GridDataItem)e.Item).ChildItem.FindControl("ctrlClosureAction");
                    Control ctrlContaintmentAction = ((GridDataItem)e.Item).ChildItem.FindControl("ctrlContaintmentAction");
 
                    ((Controls_IssueDefinationControl)ctrlIssueDefination).IssueNo = issueNo;
                    ((Controls_IssueDefinationControl)ctrlIssueDefination).RefreshDataViaParentContainer();
                    ((Controls_MyActionsControl)ctrlIsolationAction).IssueNo = issueNo;
                    ((Controls_MyActionsControl)ctrlRootCauseAction).IssueNo = issueNo;
                    ((Controls_MyActionsControl)ctrlCAPAAction).IssueNo = issueNo;
                    ((Controls_MyActionsControl)ctrlClosureAction).IssueNo = issueNo;
                    ((Controls_MyActionsControl)ctrlContaintmentAction).IssueNo = issueNo;
                }
                catch (Exception ex)
                {
                }
            }
        }
         
    }
 
    protected void IssueGrid_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridNestedViewItem)
        {
            e.Item.FindControl("InnerContainer").Visible = ((GridNestedViewItem)e.Item).ParentItem.Expanded;
        }
    }
 
    protected void IssueGrid_ItemDataBound(object sender,GridItemEventArgs e)
    {
        bool isTrimmed = false;
        string issueOwner = string.Empty;
        if (e.Item is GridDataItem && e.Item.IsDataBound)
        {
            GridDataItem gridItem = e.Item as GridDataItem;
            
            foreach (GridColumn column in IssueGrid.MasterTableView.RenderColumns)
            {
                isTrimmed = false;
                if (column is GridBoundColumn && (column.UniqueName == "IssueSummary" || column.UniqueName == "IssueDescription"))
                {
                    gridItem[column.UniqueName].ToolTip = gridItem[column.UniqueName].Text;
                    gridItem[column.UniqueName].Text = GridHelper.TrimLongText(gridItem[column.UniqueName].Text, false, out isTrimmed);
                }
                
            }
            issueOwner = gridItem["IssueOwner"].Text;
 
            if (issueOwner != Convert.ToString(Session["CLCAUserName"]))
            {
                LinkButton btnEdit = (LinkButton)gridItem["EditCommandColumn"].Controls[0];
                btnEdit.Visible = false;
            }
 
        }
        
        if (e.Item.OwnerTableView.Name.Equals("IssueList") && e.Item is GridEditFormItem && e.Item.IsInEditMode  )
        {
            if (e.Item.OwnerTableView.IsItemInserted)
            {
                if (e.Item.FindControl("ddIssueType") != null)
                {
                    ((DropDownList)e.Item.FindControl("ddIssueType")).Visible = true;
                }
                if (e.Item.FindControl("lblIssueType") != null)
                {
                    ((Label)e.Item.FindControl("lblIssueType")).Visible = false;
                }
            }
            else
            {
                if (e.Item.FindControl("ddIssueType") != null)
                {
                    ((DropDownList)e.Item.FindControl("ddIssueType")).Visible = false;
                }
                if (e.Item.FindControl("lblIssueType") != null)
                {
                    ((Label)e.Item.FindControl("lblIssueType")).Visible = true;
                }
            }
 
             
            if (e.Item.FindControl("ddIssueType") != null)
            {
                ((DropDownList)e.Item.FindControl("ddIssueType")).DataSource = GetCLCAIssueTypeLookup();
                ((DropDownList)e.Item.FindControl("ddIssueType")).DataBind();
                ((DropDownList)e.Item.FindControl("ddIssueType")).SelectedValue = DataBinder.Eval(e.Item.DataItem, "Issue").ToString();
 
            }
            if (e.Item.FindControl("ddIssueOwner") != null)
            {
                ((DropDownList)e.Item.FindControl("ddIssueOwner")).DataSource = GetCLCAUsersLookup();
                ((DropDownList)e.Item.FindControl("ddIssueOwner")).DataBind();
 
 
                ((DropDownList)e.Item.FindControl("ddIssueOwner")).SelectedValue = string.IsNullOrEmpty(DataBinder.Eval(e.Item.DataItem, "IssueOwner").ToString()) ? Session["CLCAUserName"].ToString() : DataBinder.Eval(e.Item.DataItem, "IssueOwner").ToString();
                 
            }
        }
         
    }
 
    protected void IssueGrid_InsertCommand(object source, GridCommandEventArgs e)
    {
        
        GridEditableItem editedItem = e.Item as GridEditableItem;
        objIssueManager = new IssueManager();
 
        try
        {
            objIssueManager.Issue = (editedItem.FindControl("ddIssueType") as DropDownList).SelectedItem.Value;
            objIssueManager.IssueOwner = (editedItem.FindControl("ddIssueOwner") as DropDownList).SelectedItem.Value;
            objIssueManager.IssueSummary = (editedItem.FindControl("txtIssueSummary") as TextBox).Text.Trim();
            objIssueManager.IssueDescription = (editedItem.FindControl("txtIssueDescription") as TextBox).Text.Trim();
            objIssueManager.IssueReference = (editedItem.FindControl("txtIssueReference") as TextBox).Text.Trim();
            objIssueManager.IssueStatus = IssueStatusEnum.Defination.ToString();
 
            objIssueManager.AddCLCAIssues();
 
        }
        catch (Exception ex)
        {
            ObjIssueManager.LogMessage(ex.Message + Environment.NewLine + ex.InnerException, Severity.FatalError.ToString(), ex.Source, Layer.UserInterface.ToString());
        }
 
         
       IssueGrid.MasterTableView.IsItemInserted = false;
       IssueGrid.Rebind();
    }
 
    protected void IssueGrid_UpdateCommand(object source, GridCommandEventArgs e)
    {
        GridEditableItem editedItem = e.Item as GridEditableItem;
        objIssueManager = new IssueManager();
 
        try
        {
            objIssueManager.IssueNo = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["IssueNo"].ToString());
            objIssueManager.Issue = (editedItem.FindControl("lblIssueType") as Label).Text.Trim();
            objIssueManager.IssueOwner = (editedItem.FindControl("ddIssueOwner") as DropDownList).SelectedItem.Value;
            objIssueManager.IssueSummary = (editedItem.FindControl("txtIssueSummary") as TextBox).Text.Trim();
            objIssueManager.IssueDescription = (editedItem.FindControl("txtIssueDescription") as TextBox).Text.Trim();
            objIssueManager.IssueReference = (editedItem.FindControl("txtIssueReference") as TextBox).Text.Trim();
             
 
            objIssueManager.UpdateCLCAIssues();
 
        }
        catch (Exception ex)
        {
            ObjIssueManager.LogMessage(ex.Message + Environment.NewLine + ex.InnerException, Severity.FatalError.ToString(), ex.Source, Layer.UserInterface.ToString());
        }
 
 
        IssueGrid.MasterTableView.IsItemInserted = false;
        IssueGrid.Rebind();
    }
 
     #endregion
 
    #region Action Grid Events
    #endregion
 
    #region Private Funcations
    private void SetProtectionLevel()
    {
    }
 
    #endregion
 
    #region Public Functions
 
    /// <summary>
    ///
    /// </summary>
    /// <param name="searchCriteria"></param>
    /// <returns></returns>
    public DataTable GetIssueData(string searchCriteria)
    {
        return ObjIssueManager.GetCLCAIssues(searchCriteria);
    }
    public DataTable GetCLCAIssueTypeLookup()
    {
        return objLookupManager.CLCAIssueTypeLookup();
    }
    public DataTable GetCLCAUsersLookup()
    {
        return objLookupManager.CLCAUsersLookup();
    }
 
     
    #endregion
 
}

Master Page

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="CLCALayout.master.cs" Inherits="CLCALayout" %>
<%@ Register src="Controls/BannerControl.ascx" TagName="Banner" TagPrefix="UC"  %>
<%@ Register src="Controls/TopNavControl.ascx" TagName="TopNav" TagPrefix="UC"  %>
 
<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head id="Head" runat="server">
    <title>CLCA</title>       
    <link href="../CSS/Site.css" rel="stylesheet" type="text/css"  />
    <script type="text/javascript">
 
        var panelarray = new Array();
        var shortpanelarray = new Array();
 
        function setLongScrollingPanels(longPanelNames) {
            var panellist = longPanelNames.split(",");
            for (i = 0; i < panellist.length; i++) {
                panelarray[i] = document.getElementById(panellist[i]);
            }
        }
 
        function setShortScrollingPanels(shortPanelNames) {
            var panellist = shortPanelNames.split(",");
            for (i = 0; i < panellist.length; i++) {
                shortpanelarray[i] = document.getElementById(panellist[i]);
            }
        }
 
        function setPanelWidths(strPageSizeTheme, strNavBarMode) {
            var longPanelWidth;
            var shortPanelWidth;
            var bodyContentWidth;
 
            var containerWidth = document.getElementById("divWrapper").clientWidth - 30;
            if (strPageSizeTheme == "flexible") {
                bodyContentWidth = (strNavBarMode == "expanded") ? (containerWidth - 240) : (containerWidth - 40); //TODO:adjust width
                longPanelWidth = (strNavBarMode == "expanded") ? (containerWidth - 260) : (containerWidth - 60); //TODO:adjust width
                shortPanelWidth = (strNavBarMode == "expanded") ? ((containerWidth - 280) * 0.50) : ((containerWidth - 80) * 0.50); //TODO:adjust width
 
                bodyContentWidth = bodyContentWidth + "px";
                longPanelWidth = longPanelWidth + "px";
                shortPanelWidth = shortPanelWidth + "px";
            }
            else {
                bodyContentWidth = (strNavBarMode == "expanded") ? "76%" : "96%";
                longPanelWidth = (strNavBarMode == "expanded") ? "700px" : "890px";
                shortPanelWidth = (strNavBarMode == "expanded") ? "350px" : "430px";
            }
 
            for (i = 0; i < panelarray.length; i++) {
                if (panelarray[i] != null)
                    panelarray[i].style.width = longPanelWidth;
            }
 
            for (i = 0; i < shortpanelarray.length; i++) {
                if (shortpanelarray[i] != null)
                    shortpanelarray[i].style.width = shortPanelWidth;
            }
 
            document.getElementById("tdBodyContent").style.width = bodyContentWidth;
 
        }
 
        function hideLeftMenu() {
            document.getElementById("tdLeftNavBar").style.display = "none";
            document.getElementById("tdCollapsedLeftNavBar").style.display = "block";
 
            document.getElementById("hiddenNavBarMode").value = "collapsed";
 
            setPanelWidths(document.getElementById("hiddenPageSizeMode").value, "collapsed");
            document.getElementById("tdCollapsedLeftNavBar").style.width = "17px";
 
            CallServer("Navbarcollapsed", "");
        }
 
        function showLeftMenu() {
            document.getElementById("tdLeftNavBar").style.display = 'block';
            document.getElementById("tdCollapsedLeftNavBar").style.display = 'none';
            document.getElementById("hiddenNavBarMode").value = "expanded";
            setPanelWidths(document.getElementById("hiddenPageSizeMode").value, "expanded");
            document.getElementById("tdLeftNavBar").style.width = '216px';
 
            CallServer("Navbarexpanded", "");
        }
 
        function initializeMasterPageLayout(strPageSizeTheme, strBannerMode,  strLongPanelNames, strShortPanelNames, strApplicationURL) {
            document.getElementById("hiddenApplicationURL").value = strApplicationURL;
 
            document.getElementById("hiddenPageSizeMode").value = strPageSizeTheme;
            document.getElementById("hiddenNavBarMode").value = "";
            document.getElementById("hiddenLongPanels").value = strLongPanelNames;
            document.getElementById("hiddenShortPanels").value = strShortPanelNames;
            document.getElementById("hiddenBannerMode").value = strBannerMode;
 
            if (strPageSizeTheme == "flexible")
                document.getElementById("divWrapper").style.width = "95%";
            else
                document.getElementById("divWrapper").style.width = "970px";
 
            if (strLongPanelNames != "") {
                setLongScrollingPanels(strLongPanelNames);
            }
            if (strShortPanelNames != "") {
                setShortScrollingPanels(strShortPanelNames);
            }
 
           
 
            if (strBannerMode == "expanded")
                expandBanner();
            else
                collapseBanner();
        }
 
        function ReceiveServerData(arg, context) {
            //alert(arg);
        }
 
        function openRadAlert(alertContentControlID, alertTitle) {
            window.setTimeout(function () { radalert(document.getElementById(alertContentControlID).value, 427, 340, alertTitle); }, 0);
            return false;
        }
 
        function openRadWindow(targetURL, windowName, windowTitle) {
            var oWindow = window.radopen(document.getElementById("hiddenApplicationURL").value + targetURL, windowName);
            //oWindow.SetSize(400, 400);
            //oWindow.SetTitle(windowTitle);
            return false;
        }
        </script>
</head>
<body id="main" runat="server">
    <form id="frmMasterForm" runat="server" defaultbutton="btnPageDefaultDisabled">
    <asp:ScriptManager ID="MasterScriptManager" runat="server"></asp:ScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager" runat="server">
    </telerik:RadAjaxManager>
    <div id="divWrapper" class="container-wrapper">
         <div class="container">
             <input id="hiddenApplicationURL" type="hidden" name="hiddenApplicationURL" value="" />
             <input id="hiddenNavBarMode" type="hidden" name="hiddenNavBarMode" value="" />
             <input id="hiddenBannerMode" type="hidden" name="hiddenBannerMode" value="" />
             <input id="hiddenPageSizeMode" type="hidden" name="hiddenPageSizeMode" value="" />
             <input id="hiddenShortPanels" type="hidden" name="hiddenShortPanels" value="" />
             <input id="hiddenLongPanels" type="hidden" name="hiddenLongPanels" value="" />
             <asp:Button ID="btnPageDefaultDisabled" style="display:none;" OnClientClick = "return false;" runat="server"/>
            <div class="banner">
              <UC:Banner runat="server" ID="ctrlBanner" />
            </div>
            <asp:Panel runat="server" ID="pnlTopNavBar" CssClass="banner">
                    <UC:TopNav runat="server" ID="ctrlTopNav" />
            </asp:Panel>
            <table id="tblMainBody" class="mainbody" cellpadding="0" cellspacing="0" border="0">
                   <tr valign="top">
                        <td class="sectionspacer">
                            <asp:Image ID="imgSpacer1" runat="server" ImageUrl="~/Images/master/sectionspacer.png" />
                        </td>
                        <td id="tdBodyContent" class="bodyContent" valign="top">
                            <div>
                                <asp:Panel ID="pnlAlertMsg" runat="server" Visible="false">
                                    <asp:Label ID="lblAlertMessage" runat="server" Text="" CssClass="contentLabel" Visible="false" />
                                </asp:Panel>
                                <asp:ContentPlaceHolder ID="bodyContentHolder" runat="server">
                                </asp:ContentPlaceHolder>
                            </div>
                        </td>
                        <td class="sectionspacer">
                            <asp:Image ID="imgSpacer2" runat="server" ImageUrl="~/Images/master/sectionspacer.png" />
                        </td>
                    </tr>
             </table>
             <div class="footer">
                <table width="100%" >
                    <tr>
                       
                        <td >
                             
                        </td>
                    </tr>
                    <tr>
                        
                        <td >
                            Maintained By:
                            <asp:Label runat="server" ID="lblMaintainedBy" Text="<Maintained By>" />
                            <b class="headfieldseparator">| </b>Business Owner:
                            <asp:Label runat="server" ID="lblBusinessOwner" Text="<yyyy-mon-dd>" />
                            <b class="headfieldseparator">| </b>Last Modified:
                            <asp:Label runat="server" ID="lblLastModified" Text="<yyyy-mon-dd>" />
                        </td>
                    </tr>
                </table>
              </div>
        </div>
    </form>
</body>
</html>

MyDashboard Page

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/CLCALayout.master" AutoEventWireup="true" CodeFile="MyDashboard.aspx.cs" Inherits="MyDashboard" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Charting" TagPrefix="telerik" %>
<%@ Register src="Controls/ChartControl.ascx" TagName="Chart" TagPrefix="UC"  %>
<%@ Register src="Controls/MyIssuesControl.ascx" TagName="Issue" TagPrefix="UC"  %>
<%@ Register src="Controls/MyActionsControl.ascx" TagName="Action" TagPrefix="UC"  %>
<asp:Content ID="bodyContent" ContentPlaceHolderID="bodyContentHolder" Runat="Server" >
<table width="100%">
    <tr>
        <td style="width:100%">
            <telerik:RadPanelBar ID="radpnlChartList" CausesValidation="False" runat="server" Width="100%" ExpandAnimation-Type="InOutQuad" style="vertical-align:top" >
                <Items>
                    <telerik:RadPanelItem runat="server" Text="My Chart" Expanded="True" AccessKey="C" >
                        <Items>
                             <telerik:RadPanelItem runat="server" Text="" Value="details" >
                                <ItemTemplate>
                                    <table class="pageBackground" width="100%">
                                        <tr>
                                            <td align="center" style="width:100%">
                                               <UC:Chart runat="server" ID="ctrlChart" />
                                            </td>
                                        </tr>
                                    </table>
                                </ItemTemplate>
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelBar>
        </td>
    </tr>
     <tr>
        <td style="width:100%">
            <telerik:RadPanelBar ID="radpnlMyIssueAction" CausesValidation="False" runat="server" Width="100%" style="vertical-align:top">
                <Items>
                    <telerik:RadPanelItem runat="server" Text="My Issues and Action" Expanded="True" AccessKey="M"  >
                        <Items>
                             <telerik:RadPanelItem runat="server" Text="" Value="details"  style="vertical-align:top">
                                <ItemTemplate >
                                    <table class="pageBackground" width="100%"  style="vertical-align:top"  >
                                        <tr>
                                            <td  align="center" style="vertical-align:top">
                                                <table width="100%" style="vertical-align:top" >
                                                    <tr>
                                                        <td align="left" style="vertical-align:top;">
                                                              <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="Outlook" SelectedIndex="0" MultiPageID="RadMultiPage1" Align="Justify" style="Width:700px;float:left"   >
                                                                <Tabs>
                                                                    <telerik:RadTab Text="My <u>I</u>ssues" Width="150px" AccessKey="I">
                                                                    </telerik:RadTab>
                                                                    <telerik:RadTab Text="My <u>A</u>ctions" Width="150px" AccessKey="A">
                                                                    </telerik:RadTab>
                                                                </Tabs>
                                                            </telerik:RadTabStrip>                                       
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td align="left"  style="vertical-align:top">
                                                            <telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0"
                                                                Width="100%" CssClass="multiPage" ScrollBars="Auto" Height="450">
                                                                <telerik:RadPageView runat="server" ID="RadPageView1" CssClass="corporatePageView">
                                                                   <UC:Issue runat="server" ID="ctrlMyIssue" />
                                                                </telerik:RadPageView>
                                                                <telerik:RadPageView runat="server" ID="RadPageView2" CssClass="corporatePageView">
                                                                   <UC:Action runat="server" ID="ctrlMyActions" />
                                                                </telerik:RadPageView>
                                                            </telerik:RadMultiPage>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                              
                                    </table>
                                </ItemTemplate>
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelItem>
                </Items>
            </telerik:RadPanelBar>
        </td>
    </tr>
</table>
</asp:Content>


3 Answers, 1 is accepted

Sort by
0
Atman
Top achievements
Rank 1
answered on 30 Apr 2011, 12:11 AM
HI,

I found issue here. I have put User controls withing my NestedViewTemplate. This user controls also hold another grids. When i comment out this controls. Export start working. Can you please help. I really need this control to be hosted within each grid row.

thanks,
Atman

<telerik:RadMultiPage runat="server" ID="CLCAMultiPage" SelectedIndex="0" RenderSelectedPageOnly="false">
                               
                                <telerik:RadPageView runat="server" ID="IssueDefinationView">
                                    <UC:IssueDefination runat="server" ID="ctrlIssueDefination" ActionType="Defination" />
                                </telerik:RadPageView>
                                <telerik:RadPageView runat="server" ID="IsolationView">
                                    <UC:Action runat="server" ID="ctrlIsolationAction" ActionType="Isolation"  />
                                </telerik:RadPageView>
                                <telerik:RadPageView runat="server" ID="RootCauseView">
                                    <UC:Action runat="server" ID="ctrlRootCauseAction" ActionType="RootCause"  />
                                </telerik:RadPageView>
                                <telerik:RadPageView runat="server" ID="CAPAView">
                                   <UC:Action runat="server" ID="ctrlCAPAAction" ActionType="CorrectiveAction"  />
                                </telerik:RadPageView>
                                <telerik:RadPageView runat="server" ID="ClosureView">
                                    <UC:Action runat="server" ID="ctrlClosureAction" ActionType="ClosureAction" />
                                </telerik:RadPageView>
                                <telerik:RadPageView runat="server" ID="ContaintmentView">
                                    <UC:Action runat="server" ID="ctrlContaintmentAction" ActionType="ContaintmentAction"  />
                                </telerik:RadPageView>
                            </telerik:RadMultiPage>
0
Atman
Top achievements
Rank 1
answered on 03 May 2011, 01:54 AM
Please reply no one is responding to this thread? Your help will be really appreciated!!
0
Tsvetina
Telerik team
answered on 04 May 2011, 03:06 PM
Hello Atman,

I replied to your support ticket on the same matter. Please, put your follow up posts in the formal support thread, so that we avoid duplicate ones. Thank you for your understanding.

For others who may see this, here is the reply from the other thread:

I created a small web site containing a RadGrid with a NestedViewTemplate containing a RadTabStrip. In the tabstrip there are two tabs displaying one and the same user control which contains a RadGrid. When I tried to export this to excel, there was no problem and no exception thrown.

Generally, because you have set IgnorePaging to true, the NestedViewTemplate will always be collapsed when exporting, so the problem may be related to some other part of your logic, not exactly the export procedure. Additionally, the Object reference exception is a very general one and without having runnable code to debug, we will not be able to track it down.

All the best,
Tsvetina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Atman
Top achievements
Rank 1
Answers by
Atman
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or