How to truncate text in label control

 Hello, I'm trying to figure out how to truncate text in a label control to allow maximum number of characters. I would like to avoid using code behind because the label is in a repeater and it is a nightmare to find controls there. This is what I have found here on the forum:

'<%# (Eval("ArticleText") .Length>=400) ? Eval("ArticleText").SubString(0,400) :Eval("ArticleText") %>'
However, I keep getting an error saying that the "?" operator is not allowed. I'm working in Is there a way around this or is it possible to write an inline if statement here like in classic ASP?
Any help would be greatly appreciated. Thank you! 


Read More


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s