In an ascx file I'm presenting data from a databound field like this:
<%# Eval("Description")%>
The data source is bound from code behind.
Sometimes Description
has some characters in it that I need to replace. I would love if I could just do something like this:
<%# Replace(Eval("Description"), "a", "b")%>
But of course that's not allowed in a databind operation (<%#)
.
I don't want to hard code it in code behind because it would be so ugly to extract the field in code behind, maybe extract it to a variable and then output the variable on the ascx page. I'm hoping there is some (probably really easy) way I can do the replace directly on the ascx page.
Replace
for C#? Maybe a class? Maybe a pencil? What...? Have you tried withstring.Replace(Eval....
?? – Spectacle