I have a RadGrid on my page displaying a list of search results from my database. Some of these results have associated files which I provide a download link for, and some don't.
For the results that don't have an associated file I want to hide the link in that row only. I can do that, I've found, using this code in the ItemDataBound event:
The problem is that by setting the GridDataItem's Visible property I'm effectively collapsing that column for that row, moving everything out of alignment with the grid headers. Instead, I'd like to do something to empty the contents of the cell, or change just that cell to a different column type, or something similar?
For the results that don't have an associated file I want to hide the link in that row only. I can do that, I've found, using this code in the ItemDataBound event:
if
(e.Item
is
Telerik.Web.UI.GridDataItem)
{
if
(!((
bool
)((DataRowView)e.Item.DataItem).Row[
"IsElectronic"
]))
{
((Telerik.Web.UI.GridDataItem)e.Item)[
"colDownload"
].Visible =
false
;
}
}
The problem is that by setting the GridDataItem's Visible property I'm effectively collapsing that column for that row, moving everything out of alignment with the grid headers. Instead, I'd like to do something to empty the contents of the cell, or change just that cell to a different column type, or something similar?