使用C#将此“”替换为此“”

时间:2013-04-21 15:45:56

标签: c# asp.net

如果表格行为空,我的文本框中会出现此空格“”的问题。所以我想用这个“ ”替换这个“”。例如,这就是我所拥有的:

StartTime.Text = row.Cells[5].Text;

所以这里是我想要实现的伪代码:

if (StartTime.Text == "" " then replace it with "  ")
else show the value of StartTime.Text

我知道我的C#技能太差了所以请帮忙。感谢

1 个答案:

答案 0 :(得分:8)

StartTime.Text = row.Cells[5].Text.Replace("&nbsp", " ")

怎么样?

或者我没有正确理解这个问题