I am trying to modify existing code that is similar to the following:
What I want to do is create a link so that when the "Total Cost" Header is clicked, another aspx page will open up. Is there a way to do this?
Thanks!
There are two options for this that I can think of.
One is to handle the ColumnHeaderClick event of the grid, confirm that the header that was clicked is the one you want to respond to, and in there using window.open() to open up the new page.
The other is to set the Caption of your grid to an HTML anchor tag, so that it's processed by the client as a hyperlink. This will only work if the column's HTMLEncodeContent property is set to false, which it is by default.
ch.Caption = "<a href='http://infragistics.com'>Total Cost</a>";
I got the link to work with the method above. The problem is now, when I try to export the page to Excel, the columns with the link header shows the following:
<a target='_blank' href ="TotalCost.aspx">Total Cost $</a>
It does not show "Total Cost" and none of the values in that column are displayed, or anything else that comes in the grid after that column.
What is the best way to handle this?