Last post Jul 18, 2012 12:33 PM by pinky8
Jul 16, 2012 09:39 PM|pinky8|LINK
It works fine, but when the grid is exported to Excel it displays the value for that column as a hyperlink.
How can I make it so that it displays the value as text only?
The label for each column in Excel is text only, so that is fine. But the value for that column is displayed as hyperlink.
Jul 16, 2012 09:53 PM|oned_gk|LINK
Protected Sub LinkButton1_Click(sender As Object, e As System.EventArgs) Handles LinkButton1.Click
RadGrid1.ExportSettings.ExportOnlyData = True
RadGrid1.ExportSettings.IgnorePaging = True
RadGrid1.ExportSettings.FileName = "NamaFileExport"
Jul 16, 2012 10:37 PM|pinky8|LINK
I did all of that and it still exports hyperlink. The ExportOnlyData
attribute takes care of the columns heading in Excel but not the individual cell value.
Jul 16, 2012 11:03 PM|oned_gk|LINK
My Idea is you have two columns for the hyperlink. First is the curent hyperlink and second column is text only hyperlink used to export excel. This second column always visible=false, show when exportexcel only.
Before export to excel you can hide curent hyperlink clolumn and show the textonly hyperlink column. And back again after export.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
RadGrid1.MasterTableView.GetColumn("Hyperlink1").Visible = False
RadGrid1.MasterTableView.GetColumn("Hyperlink2").Visible = True
RadGrid1.MasterTableView.GetColumn("Hyperlink1").Visible = True
RadGrid1.MasterTableView.GetColumn("Hyperlink2").Visible = False
Jul 17, 2012 01:10 PM|pinky8|LINK
That doesn't work either.
I test it out trying to change the column text to "hello" without hyperlink with the following code,
but it is not working. It stills displays "hello" as a hyperlink in Excel.
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
For Each item As GridDataItem In RadGrid1.Items
item("E").Text = "hello"
Jul 17, 2012 09:22 PM|oned_gk|LINK
I mean the first column is real hyperlink and the second column is bound column only for exporting to excel.
You use the first column as hyperlink in page and second column as textonly for exporting.
When display the page you should disable the textonly column and when exporting you disable the hyperlink column.
Jul 18, 2012 12:33 PM|pinky8|LINK
Thank you, that works.