Remove character from databinder in repeater C#

ishan joshi

n 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.

user6413674
<%# ((string)DataBinder.Eval(Container.DataItem, "Description")).Replace("a", "b") %>

user above syntax

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Need to remove character from a string in C

From Dev

sed to remove from a character to a character

From Java

how to remove special character from the beginning and end of a string in c

From Dev

Remove first character from a string using c#

From Dev

Remove new line character from C# String

From Dev

Remove text from string after a certain character in C

From Dev

C# - Remove last character from string on keydown

From Dev

How to remove the first character from a sharepoint list item C#

From Dev

Remove Escape character from object or string in c#?

From Dev

How to remove special character from c9.io editor

From Dev

How do I remove a character from a string in c++?

From Dev

How to remove a particular character from a type character

From Java

Remove the last character from a string

From Dev

(swift) remove "\" character from string?

From Dev

Remove � Special Character from String

From Java

Swift - Remove " character from string

From Dev

Remove first character from a string

From Dev

Remove a letter from a character array

From Dev

Vim remove character from position

From Dev

Remove last character from result

From Dev

Remove single character from console

From Dev

How to remove a character from a string

From Dev

Remove Specified Character From String

From Dev

Remove a character from a dynamic textfield

From Dev

Remove a character from second occurence

From Dev

Vim remove character from position

From Dev

Remove � Special Character from String

From Dev

Remove character from column of CSV

From Dev

Remove unwanted character from a variable