I have a GridView with a template column. In it I have a hyperlink control and I set it’s visibility and Navigate URL dinamically using Eval. It all works fine but now I have to add a tooltip to the control, and I need to trim the space and comma at the end of the text.
I’m doing this:
ToolTip='<%# Eval("CombinedAccessions").ToString().TrimEnd(',', ' ') %>'
This works if coded on code behind, but fails when coded on the aspx page. But If I use just TrimEnd(), that function call works fine. What am I doing wrong?
The problem is that the
'sign is breaking you attribute value ofToolTip. You can change the opening and closing sign to"but then it will be broken by the other"you have inside. The solution is to call a method in code behind:And in aspx:
I changed the
ToStringuse to avoid null value.