3 Answers, 1 is accepted
0
Hello Velkumar,
Thank you for writing.
I assume that you want the hyperlink cells to have behavior based on some condition - in some cases the cells to have normal functionality but in other cases to show only text. If so, you can do that with the following code in the CellFormatting event handler:
Attached is a sample project that comprises the code above.
If this is not the case, please describe in greater details what is your goal, so I can provide you with adequate support.
I hope this helps. Let me know if you have any additional questions.
Greetings,
Anton
the Telerik team
Thank you for writing.
I assume that you want the hyperlink cells to have behavior based on some condition - in some cases the cells to have normal functionality but in other cases to show only text. If so, you can do that with the following code in the CellFormatting event handler:
GridHyperlinkCellElement gridLink = e.CellElement
as
GridHyperlinkCellElement;
if
(gridLink ==
null
|| e.Row.Cells[
"TextBoxColumn"
].Value ==
null
)
{
return
;
}
if
(e.Row.Cells[
"TextBoxColumn"
].Value.ToString() ==
"bbbbb"
)
{
gridLink.ContentElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
e.CellElement.DrawText =
true
;
e.CellElement.Text = gridLink.ContentElement.Text;
}
Attached is a sample project that comprises the code above.
If this is not the case, please describe in greater details what is your goal, so I can provide you with adequate support.
I hope this helps. Let me know if you have any additional questions.
Greetings,
Anton
the Telerik team
0
Joshua
Top achievements
Rank 1
answered on 08 May 2013, 06:36 PM
I am using the code you provided, the problem is when you scroll the grid, the hyperlinks get removed for cells where I need the links to stay. To the point where all the links are gone. Is there a fix for that?
0
Hi Joshua,
Thank you for writing.
In your CellFormatting event you should reset the value of the properties that you are changing, because RadGridView uses UI virtualization for its cells i.e. they are reused to display different data - see this blog for more information.
Consider the following example:
I hope this helps.
All the best,
Anton
the Telerik team
Thank you for writing.
In your CellFormatting event you should reset the value of the properties that you are changing, because RadGridView uses UI virtualization for its cells i.e. they are reused to display different data - see this blog for more information.
Consider the following example:
void
radGridView1_CellFormatting(
object
sender, CellFormattingEventArgs e)
{
GridHyperlinkCellElement gridLink = e.CellElement
as
GridHyperlinkCellElement;
if
(gridLink ==
null
|| e.Row.Cells[
"TextBoxColumn"
].Value ==
null
)
{
return
;
}
if
(e.Row.Cells[
"TextBoxColumn"
].Value.ToString() ==
"bbbbb"
)
{
gridLink.ContentElement.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
e.CellElement.DrawText =
true
;
e.CellElement.Text = gridLink.ContentElement.Text;
}
else
{
gridLink.ContentElement.ResetValue(LightVisualElement.VisibilityProperty, ValueResetFlags.Local);
gridLink.ResetValue(LightVisualElement.DrawTextProperty, ValueResetFlags.Local);
}
}
I hope this helps.
All the best,
Anton
the Telerik team
RadChart for WinForms is obsolete. Now what?