Hi,
We have implemented template columns in the telerik grid
We are tryig to use export to excel functionallity, which works great, except that it doesn't export data in the template columns. The columns are in the Excel, but they are all empty.
ASPX Code As folows:
<
telerik:GridHyperLinkColumn UniqueName="IH_LOG_NUMBER" DataTextField="IH_LOG_NUMBER"
HeaderText="<%$ Resources:Multilingual, IHLogNumber %>">
</telerik:GridHyperLinkColumn>
<telerik:GridBoundColumn Visible="false" UniqueName="IH_LOG_Exp" DataField="IH_LOG_NUMBER"
HeaderText="<%$ Resources:Multilingual, IHLogNumber %>">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn AllowFiltering="False" UniqueName="Comments" HeaderText="<%$ Resources:Multilingual, Comments %>" >
<ItemTemplate>
<asp:DropDownList ID="ddlComments" CssClass="DDDW" AppendDataBoundItems="true" runat="server"
SelectedValue='<%# Bind("COMMENT_ID") %>' DataSourceID="SqlDataSource1" DataTextField="COMMENT_NAME"
DataValueField="COMMENT_ID" Style="width: 100px;">
<asp:ListItem Value="0" Text="Please Select" Selected="True"></asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
<HeaderStyle Width="100px" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="<%$ Resources:Multilingual, ApprovedInvalidateDate %>" AllowFiltering="False"
UniqueName="SAMPLE_VALIDATED_DATE">
<ItemTemplate>
<telerik:RadDatePicker ID="rdpSampleDate" DbSelectedDate='<%# Bind("SAMPLE_VALIDATED_DATE", "{0:d}") %>'
runat="server" >
</telerik:RadDatePicker>
</ItemTemplate>
<HeaderStyle Width="130px" />
<ItemStyle Wrap="True" />
</telerik:GridTemplateColumn>
Below are the lines of code that export to Excel:
private
void ConfigureExport()
{
rGrdSampleList.MasterTableView.GetColumn(
"ClientSelectColumn").Visible = false;
rGrdSampleList.MasterTableView.GetColumn(
"EQUIPMENT_ID").Visible = false;
rGrdSampleList.MasterTableView.GetColumn(
"IH_LOG_NUMBER").Visible = false;
rGrdSampleList.MasterTableView.GetColumn(
"IH_LOG_Exp").Visible = true;
rGrdSampleList.MasterTableView.Columns.FindByUniqueName("Comments").Visible = true; rGrdSampleList.MasterTableView.Columns.FindByUniqueName(
"SAMPLE_VALIDATED_DATE").Visible = true;
rGrdSampleList.ExportSettings.ExportOnlyData =
true;
rGrdSampleList.ExportSettings.OpenInNewWindow =
true;
//rGrdSampleList.ExportSettings.IgnorePaging = true;
}
protected void RadMenu1_ItemClick1(object sender, RadMenuEventArgs e)
{
try
{
ConfigureExport();
if (e.Item.Text == Resources.Multilingual.Word)
{
//MsgBox"1")
rGrdSampleList.MasterTableView.ExportToWord();
}
else if (e.Item.Text == Resources.Multilingual.Excel)
{
//MsgBox"2")
rGrdSampleList.MasterTableView.ExportToExcel();
}
else if (e.Item.Text == Resources.Multilingual.Pdf)
{
rGrdSampleList.MasterTableView.ExportToPdf();
}
}
catch (Exception exe)
{
exe.ToString();
}
}
Is this by design or are there workarounds?I'm Waiting for reply as soon as possible
Thanks.