bharat kumar
                                            
                                    
    Top achievements
    
            
                
                Rank 1
            
    
                                        
                                        bharat kumar
                                        asked on 15 Oct 2010, 03:28 PM
                                    
                                Hi ,
i am using radgrid multiple grid export functionality but while click on export button i am getting below error..
RadGrid must be databound before exporting.
my grid is below...
 <div>
               <telerik:RadGrid ID="RadGridWrapper" runat="server" Width="550px"
            BorderStyle="None" >
            <ExportSettings OpenInNewWindow="true" />
            <MasterTableView AutoGenerateColumns="true" BorderStyle="None">
                <ItemTemplate>
                    <telerik:RadGrid ShowGroupPanel="true" AutoGenerateColumns="false" ID="grdEURPlanning"
        DataSourceID="EURPlanningDataSource"  AllowSorting="True" Width="130px"
        ShowFooter="True" runat="server" EnableLinqExpressions="false" Skin="Office2007" GridLines="Horizontal" OnPreRender="grdEURPlanning_PreRender">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <MasterTableView ShowGroupFooter="true" AllowMultiColumnSorting="true"
           TableLayout="Fixed" AlternatingItemStyle-BackColor="#F2F3F5" HeaderStyle-Font-Bold="true">
            <Columns>
                       <telerik:GridBoundColumn
                                            DataField="FinancialAccountGroupText"
                                            Visible="true"
                                            HeaderText="Category"
                                            FooterText="Total"
                                            FooterStyle-Font-Bold ="true"
                                            FooterStyle-HorizontalAlign ="Left"  
                                            HeaderStyle-Width="50px"                                           
                                        >
                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn
                                            DataField="Estimation"
                                            Visible="true"
                                            HeaderText="Estimation"
                                            DataFormatString="€{0:### ###.00}"
                                            ItemStyle-HorizontalAlign = "Right"
                                            HeaderStyle-HorizontalAlign = "Right"
                                            Aggregate = "Sum"
                                            FooterStyle-Font-Bold ="true"
                                            FooterStyle-HorizontalAlign ="Right"
                                            HeaderStyle-Width="50px"
                                        >
                                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings EnableAlternatingItems="true"
                                EnableRowHoverStyle="true"
                            >
                <Selecting AllowRowSelect="True" />
                </ClientSettings>                
            </telerik:RadGrid>
                    <br />
                   <telerik:RadGrid ShowGroupPanel="true" AutoGenerateColumns="false" ID="grdEURAllocation"
        DataSourceID="EURAllocationDataSource"  AllowSorting="True" Width="390px"
        ShowFooter="True" runat="server" EnableLinqExpressions="false" Skin="Office2007" GridLines="Horizontal">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <MasterTableView ShowGroupFooter="true" AllowMultiColumnSorting="true" TableLayout="Fixed"
            AlternatingItemStyle-BackColor="#F2F3F5" HeaderStyle-Font-Bold="true">
            <Columns>
                        <telerik:GridBoundColumn DataField="DestinationFund" HeaderText="Fund" SortExpression="DestinationFund"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"
                            UniqueName="DestinationFund"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="30px"
                            />
                        <telerik:GridBoundColumn DataField="DestUserProj" HeaderText="User Proj" SortExpression="DestUserProj"
                            UniqueName="DestUserProj" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"
                            HeaderStyle-Width="50px"
                             />
                        <telerik:GridHyperLinkColumn DataTextField="CostCentre" HeaderText="Cost Centre" SortExpression="CostCentre"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"
                            UniqueName="CostCentre"
                            DataNavigateUrlFields="Id"
                            DataNavigateUrlFormatString="~/Allotment/Allotment.aspx?allotmentId={0}&ViewMode=ReadOnly"
                            Target="_blank"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="50px"
                            />
                        <telerik:GridBoundColumn DataField="AllotmentDate" HeaderText="Date" SortExpression="AllotmentDate"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="AllotmentDate"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="60px"
                            />
                        <telerik:GridBoundColumn DataField="PlannedAmountInt" HeaderText="Amount" SortExpression="PlannedAmountInt"
                            Aggregate="Sum"
                            DataFormatString="€{0:### ### ### ###.00}"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="PlannedAmountInt"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="60px"
                            />
                    </Columns>               
            <GroupByExpressions>
                <telerik:GridGroupByExpression>
                    <GroupByFields>
                        <telerik:GridGroupByField FieldName="Fund" />
                    </GroupByFields>
                    <SelectFields>
                        <telerik:GridGroupByField FieldName="Fund" HeaderText="Fund" />
                    </SelectFields>
                </telerik:GridGroupByExpression>
            </GroupByExpressions>
        </MasterTableView>
        <ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true">
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
        <GroupingSettings ShowUnGroupButton="true" />
    </telerik:RadGrid>
                    <br />
                   <telerik:RadGrid ShowGroupPanel="true" AutoGenerateColumns="false" ID="grdEURExpenditures"
        DataSourceID="EURExpendituresDataSource"  AllowSorting="True" Width="600px"
        ShowFooter="True" runat="server" EnableLinqExpressions="false" Skin="Office2007" GridLines="Horizontal">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <MasterTableView ShowGroupFooter="true" AllowMultiColumnSorting="true"
           TableLayout="Fixed" AlternatingItemStyle-BackColor="#F2F3F5" HeaderStyle-Font-Bold="true">
            <Columns>
                        <telerik:GridBoundColumn DataField="Fund" HeaderText="Fund" SortExpression="Fund"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"
                            UniqueName="Fund"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="25px"
                            />
                        <telerik:GridBoundColumn DataField="Account" HeaderText="Account" SortExpression="Account"
                            UniqueName="Account" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"
                             HeaderStyle-Width="35px" />
                        <telerik:GridBoundColumn DataField="UserProj" HeaderText="User Proj" SortExpression="UserProj"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"
                            UniqueName="UserProj"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="50px"
                            />
                        <telerik:GridBoundColumn DataField="CostCentre" HeaderText="Cost Centre" SortExpression="CostCentre"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="CostCentre"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="50px"
                            />
                        <telerik:GridBoundColumn DataField="Unliquidated" HeaderText="Unliquidated" SortExpression="Unliquidated"
                            Aggregate="Sum"
                            DataFormatString="€{0:### ### ### ###.00}"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="Unliquidated"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right"
                            HeaderStyle-Width="60px"
                            />
                            <telerik:GridBoundColumn DataField="Disbursement" HeaderText="Disbursement" SortExpression="Disbursement"
                            Aggregate="Sum"
                            DataFormatString="€{0:### ### ### ###.00}"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="Disbursement"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="65px"
                            />
                            <telerik:GridBoundColumn DataField="ExtRef" HeaderText="ExtRef" SortExpression="ExtRef"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="ExtRef"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="60px"
                            />
                             <telerik:GridBoundColumn DataField="ExpDate" HeaderText="Exp Date" SortExpression="ExpDate"
                            FooterStyle-Font-Bold ="true"
                            FooterStyle-HorizontalAlign ="Right"                            
                            UniqueName="ExpDate"
                            HeaderStyle-HorizontalAlign="Right"
                            ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="60px"
                            />
                    </Columns>
                     <GroupByExpressions>
                <telerik:GridGroupByExpression>
                    <GroupByFields>
                        <telerik:GridGroupByField FieldName="Fund" />
                    </GroupByFields>
                    <SelectFields>
                        <telerik:GridGroupByField FieldName="Fund" HeaderText="Fund" />
                    </SelectFields>
                </telerik:GridGroupByExpression>
            </GroupByExpressions>
                </MasterTableView>
        <ClientSettings AllowDragToGroup="true" EnableRowHoverStyle="true">
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
        <GroupingSettings ShowUnGroupButton="true" />
            </telerik:RadGrid>
                </ItemTemplate>
            </MasterTableView>
        </telerik:RadGrid>
           </div>
protected void btnExportWord_Click(object sender, EventArgs e)
    {
         RadGridWrapper.MasterTableView.ExportToWord();
}
this approach i used from the below reply...
You can try the following approach:
Export multiple RadGrids in single PDF/Excel file
Regards,
Daniel
the Telerik team
My req. is that on my page i have 3 radgrid and all different grid having no relation with each other and i want to export the data of all 3 grids into one word file.
Please help.
waiting for your reply.
}
this approach i used from the below reply...
You can try the following approach:
Export multiple RadGrids in single PDF/Excel file
Regards,
Daniel
the Telerik team
My req. is that on my page i have 3 radgrid and all different grid having no relation with each other and i want to export the data of all 3 grids into one word file.
Please help.
waiting for your reply.
3 Answers, 1 is accepted
0
                                Hello Bharat,
Try the following:
Regards,
Daniel
the Telerik team
                                        Try the following:
protected void Button1_Click1(object sender, EventArgs e){    RadGridWrapper.DataSource = new string[] { " " };    RadGridWrapper.Rebind();    RadGridWrapper.MasterTableView.ExportToWord();}Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the 
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
                                
                                                    bharat kumar
                                                    
                                            
    Top achievements
    
            
                
                Rank 1
            
    
                                                
                                                answered on 21 Oct 2010, 11:39 AM
                                            
                                        Thanks Daniel for your reply.
it works but not fully workable.
i need some more help..
1. how to set the title for different grids so it come as header of the grid.
like GRID 1
...
GRID 2
;;;;
GRID 3
;;;
2. the colums of the grid come as hyperlink so how to remove than and show only text.
3. the font size is too big so how to minimize it.
please see the attached document how it looks....
so please help me how to make it user friendly.
thanks again and waiting for your reply.
                                        it works but not fully workable.
i need some more help..
1. how to set the title for different grids so it come as header of the grid.
like GRID 1
...
GRID 2
;;;;
GRID 3
;;;
2. the colums of the grid come as hyperlink so how to remove than and show only text.
3. the font size is too big so how to minimize it.
please see the attached document how it looks....
so please help me how to make it user friendly.
thanks again and waiting for your reply.
0
                                Hello Bharat,
1. You could use the Caption property of the corresponding TableView.
2. It is possible to replace the controls with plain text on ItemDataBound.
Word/Excel export (HTML-based) (Using ItemCreated/ItemDataBound)
3. I recommend that you examine the aforementioned help topic.
Regards,
Daniel
the Telerik team
                                        1. You could use the Caption property of the corresponding TableView.
RadGrid1.MasterTableView.Caption = "GRID 1";2. It is possible to replace the controls with plain text on ItemDataBound.
Word/Excel export (HTML-based) (Using ItemCreated/ItemDataBound)
3. I recommend that you examine the aforementioned help topic.
Regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the 
Telerik Public Issue Tracking
system and vote to affect the priority of the items