views:

271

answers:

3

This seems like it should be a simple thing to do, but I can't figure it out.

I have a localized resource that I'm using in two places - one as a col. header in a datagrid, and then as a descriptor beside a field when the user edits a row.

The text of the label looks like:

Text="<%$Resources:Global,keyName%>"

However, I'd like to add a trailing : to the label - except if I change the above to

Text="<%$Resources:Global,keyName%>:"

then the : is the only thing that shows up! I've tried it with simple strings, so there's nothing special about the colon char that causes this.

Surely I don't have to have 2 different resources?

A: 

Have you tried Text="<%$Resources:Global,keyName%>" + ":" ? You'd basically be concatenating two strings. Or treat them as two strings

StringBuilder t;
t.append(<%$Resources:Global,keyName%>)
t.append(":")
Text = t;
MunkiPhD
Tried the first suggestion, didn't work. But that was a clue to what should have been obvious - thanks.
chris
A: 

Assuming you need to keep the : together for styling reasons, replace the label with a span: <%=Resources.Global.keyName %>:

eglasius
+1  A: 

Well, sometimes the obvious isn't so obvious until someone else looks at it:

Text="<%$Resources:Global,keyName%>" /> :

Just move the : outside the label tag, and all is well.

chris
True, that's so obvious it's not even funny. It's one of the downsides of the "tag soup" when mixing back-end code with html
MunkiPhD