Hi,
I have a RadGrid with empty columns list inside a RadAjaxPanel. I add all columns on page load event. I have one column which needs to show multiple hyperlinks, so I create a class that implements ITemplate and set the column's Itemtemplate to this new class as show below.
All other columns are GridBoundColumns. When I export the grid, all columns except this custom column exports the data fine. I tried setting data in ItemCommand on excel export command as show below.
Can anyone please help why the export for the custom column is not working.
Thank you in advance,
Ana
I have a RadGrid with empty columns list inside a RadAjaxPanel. I add all columns on page load event. I have one column which needs to show multiple hyperlinks, so I create a class that implements ITemplate and set the column's Itemtemplate to this new class as show below.
public class HyperlinksTemplateColumn : ITemplate {
protected Label _value;
public void InstantiateIn(System.Web.UI.Control container) {
_value = new Label();
_value.ID = "_hyperlinkLabel" ;
container.Controls.Add(_value);
}
}
GridTemplateColumn customCol = new GridTemplateColumn();
radGrid.MasterTableView.Columns.Add(customCol);
customCol.ItemTemplate = new HyperlinksTemplateColumn();
All other columns are GridBoundColumns. When I export the grid, all columns except this custom column exports the data fine. I tried setting data in ItemCommand on excel export command as show below.
protected void radGrid_ItemCommand(object sender, GridCommandEventArgs e) {
if (e.CommandName == RadGrid.ExportToExcelCommandName) {
foreach (GridDataItem item in radGrid.MasterTableView.Items) {
item[CmSwAgreementConstants.HYPERLINK_COLUMN_UNIQUE_NAME].Text = "set corresponding data her"
}
}
}
Can anyone please help why the export for the custom column is not working.
Thank you in advance,
Ana