Hello everyone, I'm encountering some issues when I tried to export excel from Grid. I added three GridTemplateColumn which contained buttons in those template columns. The Export To Excel button is added with Telerik RadButton separately because of user requirement. When I clicked the export to excel button, the button inside of the GridTemplateColumn becomes null value. Can someone help me how to solve it?
The following code is my Telerik Grid
The following code is my Telerik Grid
<
telerik:RadGrid
ID
=
"RadGridSalesOrder"
runat
=
"server"
Width
=
"100%"
Height
=
"600px"
OnNeedDataSource
=
"RadGridSalesOrder_NeedDataSource"
OnItemDataBound
=
"RadGridSalesOrder_ItemDataBound"
OnBiffExporting
=
"RadGridSalesOrder_BiffExporting"
OnPreRender
=
"RadGridSalesOrder_PreRender"
GridLines
=
"None"
AllowSorting
=
"false"
ShowGroupPanel
=
"false"
ShowFooter
=
"false"
CellSpacing
=
"0"
AutoGenerateColumns
=
"False"
RenderMode
=
"Auto"
ClientSettings-Selecting-AllowRowSelect
=
"true"
FooterStyle-Height
=
"20px"
EnableHeaderContextFilterMenu
=
"True"
AllowPaging
=
"true"
PageSize
=
"2000"
AllowMultiRowSelection
=
"false"
MasterTableView-EnableHeaderContextFilterMenu
=
"true"
EnableLinqExpressions
=
"False"
EnableHeaderContextMenu
=
"True"
>
<
ClientSettings
AllowRowsDragDrop
=
"false"
AllowColumnsReorder
=
"true"
Resizing-AllowColumnResize
=
"true"
ReorderColumnsOnClient
=
"true"
>
<
ClientEvents
OnCommand
=
"GridCommand"
/>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
SaveScrollPosition
=
"false"
ScrollHeight
=
"250"
></
Scrolling
>
<
Selecting
AllowRowSelect
=
"True"
EnableDragToSelectRows
=
"true"
/>
</
ClientSettings
>
<
ExportSettings
FileName
=
"SalesOrderApprovalList"
IgnorePaging
=
"true"
>
<
Excel
Format
=
"Biff"
/>
</
ExportSettings
>
<
GroupingSettings
CaseSensitive
=
"false"
/>
<
MasterTableView
DataKeyNames
=
"OrderID,BranchID,CustomerID,CustomerInfo,OrderDate,DeliveryDate,Address"
AllowMultiColumnSorting
=
"True"
AllowPaging
=
"true"
ClientDataKeyNames
=
"OrderID,BranchID,CustomerID,CustomerInfo,Address,SalesPersonID,Remark,OrderDate,DeliveryDate"
PagerStyle-PageSizes
=
"500,1000,1500,2000"
AllowFilteringByColumn
=
"true"
AutoGenerateColumns
=
"false"
ShowHeadersWhenNoRecords
=
"true"
>
<
Columns
>
<
telerik:GridButtonColumn
UniqueName
=
"Update"
ButtonType
=
"ImageButton"
ImageUrl
=
"../images/icons8-window-settings-20.png"
HeaderText
=
"Open"
Text
=
"Open"
CommandName
=
"Open"
>
<
HeaderStyle
Width
=
"40px"
/>
<
ItemStyle
Width
=
"40px"
HorizontalAlign
=
"Center"
/>
</
telerik:GridButtonColumn
>
<
telerik:GridTemplateColumn
HeaderText
=
"No"
UniqueName
=
"RowNumber"
AllowFiltering
=
"false"
>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblRowNumber"
Width
=
"50px"
Text='<%# Container.DataSetIndex+1 %>'></
asp:Label
>
</
ItemTemplate
>
<
ItemStyle
Width
=
"30px"
/>
<
HeaderStyle
Width
=
"30px"
/>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"Approve"
HeaderStyle-Width
=
"90px"
ShowFilterIcon
=
"false"
AllowFiltering
=
"false"
>
<
ItemTemplate
>
<
div
style
=
"text-align: center;"
>
<
telerik:RadButton
ID
=
"btnApprove"
runat
=
"server"
AutoPostBack
=
"true"
Text
=
"Approve"
OnClientClicking
=
"OnClientClicking"
OnClick
=
"btnApprove_Click"
>
</
telerik:RadButton
>
</
div
>
</
ItemTemplate
>
<
ItemStyle
Width
=
"90px"
/>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"BatchExpiry"
AllowFiltering
=
"false"
>
<
ItemTemplate
>
<%-- <
asp:LinkButton
ID
=
"btnAddBatch"
Text
=
"Add Batch"
runat
=
"server"
>
</
asp:LinkButton
>--%>
<%-- <
telerik:RadLinkButton
ID
=
"btnAddBatch"
runat
=
"server"
Text
=
"Add Batch"
>
</
telerik:RadLinkButton
>--%>
<
telerik:RadButton
ID
=
"btnAddBatch"
runat
=
"server"
Text
=
"Add Batch"
AutoPostBack
=
"true"
OnClick
=
"btnAddBatch_Click"
></
telerik:RadButton
>
</
ItemTemplate
>
<
ItemStyle
Width
=
"45px"
/>
<
HeaderStyle
Width
=
"45px"
/>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"IsReserved"
AllowFiltering
=
"true"
HeaderText
=
"Is Reserved"
UniqueName
=
"IsReserved"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"75px"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"90px"
/>
<
ItemStyle
Width
=
"90px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"OrderID"
AllowFiltering
=
"true"
HeaderText
=
"Order ID"
UniqueName
=
"OrderID"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"100px"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"110px"
/>
<
ItemStyle
Width
=
"110px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"BranchID"
AllowFiltering
=
"false"
HeaderText
=
"Branch ID"
UniqueName
=
"BranchID"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"100px"
Visible
=
"false"
AutoPostBackOnFilter
=
"false"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"110px"
/>
<
ItemStyle
Width
=
"110px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SalesPersonName"
HeaderText
=
"Sales Person"
UniqueName
=
"SalesPersonName"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"105px"
AllowFiltering
=
"true"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"120px"
/>
<
ItemStyle
Width
=
"120px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CustomerID"
AllowFiltering
=
"true"
HeaderText
=
"Customer ID"
Visible
=
"true"
UniqueName
=
"CustomerID"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"110px"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"130px"
/>
<
ItemStyle
Width
=
"130px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CustomerName"
HeaderText
=
"Name"
UniqueName
=
"CustomerName"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"150px"
AllowFiltering
=
"true"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"189px"
/>
<
ItemStyle
Width
=
"189px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CustomerInfo"
HeaderText
=
"Customer Info"
UniqueName
=
"CustomerInfo"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"150px"
AllowFiltering
=
"false"
Visible
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"189px"
/>
<
ItemStyle
Width
=
"189px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Address"
HeaderText
=
"Address"
UniqueName
=
"Address"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"170px"
AllowFiltering
=
"true"
Visible
=
"true"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"189px"
/>
<
ItemStyle
Width
=
"189px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Township"
HeaderText
=
"Township"
UniqueName
=
"Township"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"120px"
AllowFiltering
=
"true"
Visible
=
"true"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"150px"
/>
<
ItemStyle
Width
=
"150px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"OrderDate"
AllowFiltering
=
"false"
HeaderText
=
"Order Date"
UniqueName
=
"OrderDate"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"110px"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"85px"
/>
<
ItemStyle
Width
=
"85px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DeliveryDate"
AllowFiltering
=
"false"
HeaderText
=
"Delivery Date"
UniqueName
=
"DeliveryDate"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"110px"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"85px"
/>
<
ItemStyle
Width
=
"85px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DeliveryVan"
AllowFiltering
=
"true"
HeaderText
=
"Delivery Van"
UniqueName
=
"DeliveryVan"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"100px"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"110px"
/>
<
ItemStyle
Width
=
"110px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"SalesPersonID"
DataField
=
"SalesPersonID"
AllowFiltering
=
"true"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"100px"
HeaderText
=
"SalesPerson ID"
Visible
=
"false"
CurrentFilterFunction
=
"Contains"
AutoPostBackOnFilter
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Remark"
HeaderText
=
"Remark"
UniqueName
=
"Remark"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"84px"
AllowFiltering
=
"true"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"104px"
/>
<
ItemStyle
Width
=
"104px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"SyncDateTime"
HeaderText
=
"Sync Date"
UniqueName
=
"SyncDateTime"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"84px"
AllowFiltering
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"85px"
/>
<
ItemStyle
Width
=
"85px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ExportDateTime"
HeaderText
=
"Export Date"
UniqueName
=
"ExportDateTime"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"84px"
AllowFiltering
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"85px"
/>
<
ItemStyle
Width
=
"85px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ExportStatus"
HeaderText
=
"Export Status"
UniqueName
=
"ExportStatus"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"75px"
AllowFiltering
=
"true"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"85px"
/>
<
ItemStyle
Width
=
"85px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ExportRemark"
HeaderText
=
"Export Remark"
UniqueName
=
"ExportRemark"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"84px"
AllowFiltering
=
"true"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"104px"
/>
<
ItemStyle
Width
=
"104px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ApprovedBy"
HeaderText
=
"Approved By"
UniqueName
=
"ApprovedBy"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"84px"
AllowFiltering
=
"true"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"104px"
/>
<
ItemStyle
Width
=
"104px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ApprovedDate"
HeaderText
=
"Approved Date"
UniqueName
=
"ApprovedDate"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"84px"
AllowFiltering
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"85px"
/>
<
ItemStyle
Width
=
"85px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"RejectedBy"
HeaderText
=
"Rejected By"
UniqueName
=
"RejectedBy"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"84px"
AllowFiltering
=
"true"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"104px"
/>
<
ItemStyle
Width
=
"104px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"RejectedDate"
HeaderText
=
"Rejected Date"
UniqueName
=
"RejectedDate"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"84px"
AllowFiltering
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
<
HeaderStyle
Width
=
"85px"
/>
<
ItemStyle
Width
=
"85px"
/>
</
telerik:GridBoundColumn
>
<%--<
telerik:GridBoundColumn
DataField
=
"DeliveryStatus"
HeaderText
=
"Status"
UniqueName
=
"Status"
Visible
=
"false"
ShowFilterIcon
=
"false"
FilterControlWidth
=
"170px"
AllowFiltering
=
"true"
AutoPostBackOnFilter
=
"true"
>
<
HeaderStyle
Width
=
"50px"
/>
<
ItemStyle
Width
=
"50px"
/>
</
telerik:GridBoundColumn
>--%>
</
Columns
>
<
PagerStyle
AlwaysVisible
=
"True"
></
PagerStyle
>
<
GroupFooterTemplate
>
</
GroupFooterTemplate
>
</
MasterTableView
>
<
PagerStyle
UseRouting
=
"True"
Mode
=
"NumericPages"
ShowPagerText
=
"False"
/>
</
telerik:RadGrid
>