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

Export Radgird from usercontrol and mainpage to Excel file

1 Answer 76 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 21 Mar 2015, 01:47 AM
Hi Admin, I want to export a  excel report file. It include infomation customer( radgrid on usercontrol), oder(radgrid on usercontrol), order detail (Radgird on mainpage). I dont know how to combie data on many control-> a report.
Please show me how to solve it!
Thanks
David Tran

<div id="uxPOContainer" runat="server" class="POContainer">
        <asp:HiddenField runat="server" ID="hdfOrderId" />
        <uc:CustomerInfo ID="uxCustomerInfo" runat="server"></uc:CustomerInfo>
        <uc:OrderInfo ID="uxOrderInfo" runat="server"/>        
        <div class="myborder" ></div>
        <asp:Button ID="uxEditOrd" runat="server" Text ="Edit Order" OnClick="uxEditOrd_Click" CssClass="ButtonType1" Visible="false"  />
        <asp:PlaceHolder ID="phDetail" runat="server">
            <ext:RadListView runat="server" ID="rlvOrderDetail" ItemPlaceholderID="plhDetail" OnItemDataBound="rlvOrderDetail_ItemDataBound"
                OnNeedDataSource="rlvOrderDetail_NeedDataSource" OnItemCreated="rlvOrderDetail_ItemCreated" BorderWidth="1" >
                <LayoutTemplate>
                    <table class="FixTableOD TablePaddingTD TableWithInputFocus" border="1">
                        <colgroup>
                            <col class="w5" />
                            <col class="w25" />
                            <col class="w15" />
                            <col class="w10" />
                            <col class="w10" />
                            <col class="w15" />
                            <col class="w10" />
                            <col class="w10" />
                        </colgroup>

                        <thead class="TableHeader">
                            <tr>
                                <th></th>
                                <th class="FormatString"><%# Resources.LocalizedStrings.FieldName_ProductName %></th>
                                <th class="FormatNumber"><%# Resources.LocalizedStrings.FieldName_Quantity %></th>
                                <th class="FormatCode"><%# Resources.LocalizedStrings.Products_Grid_ProductUnit %></th>
                                <th class="FormatNumber"><%# Resources.LocalizedStrings.FieldName_UnitPrice %></th>
                                <th class="FormatNumber"><%# Resources.LocalizedStrings.FieldName_Amount %></th>
                                <th class="FormatDate"><%# Resources.LocalizedStrings.FieldName_ExpectDeliveryDate %></th>
                                <th class="FormatNumber"><%# Resources.LocalizedStrings.FieldName_CBM %></th>
                            </tr>
                        </thead>
                        <tbody>
                            <asp:PlaceHolder ID="plhDetail" runat="server"></asp:PlaceHolder>

                        </tbody>
                        <tfoot class="OrderDetailFooter inlineTableBg">
                            <tr>
                                <td colspan="2" >
                                    <asp:Label ID="Label1" runat="server" Text="<%$ Resources: LocalizedStrings,FieldName_Total %>"> </asp:Label>

                                </td>
                                <td class="FormatNumber" >
                                    <asp:Literal runat="server" ID="ltrTotalQuantity"></asp:Literal>
                                      <p class="totalQty">
                                    <asp:Literal runat="server" ID="ltrTotalQtyByCarton">
                                    </asp:Literal>
                                    <br />
                                    <asp:Literal runat="server" ID="ltrTotalQtyByPcs">
                                    </asp:Literal>
                                </p>
                                </td>
                                <td></td>
                                <td></td>
                                <td class="FormatNumber">
                                    <asp:Literal runat="server" ID="ltrTotalAmount"></asp:Literal>

                                </td>
                                <td></td>
                                <td class="FormatNumber">
                                    <asp:Literal runat="server" ID="ltrTotalCBM"></asp:Literal>
                                </td>
                            </tr>
                        </tfoot>
                    </table>
                </LayoutTemplate>

                <ItemTemplate>
                    <div id="uxCalc">
                        <tr>
                            <td class="FormatNumber">
                                <%# Container.DataItemIndex + 1 %>
                            </td>
                            <td title='<%# Eval("ProductId") %>'>
                                <asp:HiddenField ID="ItemIndex" Value="<%# Container.DataItemIndex %>" runat="server" />
                                <%# Eval("ProductName") %>
                            </td>

                            <td class="FormatNumber">
                                <asp:Label  ID="uxQuantity" runat="server"><%# (int.Parse( Eval("Quantity").ToString())).ToString("#,##0") %></asp:Label>
                              

                            </td>
                            <td class="FormatCode">
                                <asp:Label ID="uxUOM" runat="server" Visible="false"  ><%#  Eval("UOM").ToString() %> </asp:Label>
                                <asp:Label ID="uxUOMName" runat="server" ></asp:Label> 
                            </td>
                            <td class="FormatNumber">
                                 <asp:Label ID="uxUnitPrice" runat="server"><%# (double.Parse( Eval("UnitPrice").ToString())).ToString("#,##0.00") %></asp:Label>
                            </td>
                            <td class="FormatNumber">
                                 <asp:Label ID="uxAmount" runat="server"><%# (double.Parse( Eval("Amount").ToString())).ToString("#,##0.00")  %></asp:Label>
                            </td>

                            <td class="FormatDate">
                                <asp:Label ID="uxExpectDeliveryDate" runat="server"><%# Eval("ExpectDeliveryDate").ToString() %></asp:Label>
                            </td>
                            <td class="FormatNumber">
                                 <asp:Label ID="uxCBM" runat="server"><%# double.Parse( Eval("CBM").ToString()) %></asp:Label>
                                
                            </td>
                        </tr>
                    </div>
                </ItemTemplate>


            </ext:RadListView>
        </asp:PlaceHolder>
    </div>

1 Answer, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 25 Mar 2015, 02:18 PM
Hello David,

I would recommend you to check out the following example which demonstrates how to export a multiple RadGrids in a single Excel file. You can use a similar approach to combine and generate an Excel document.

Regards,
Kostadin
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Share this question
or