有这样一段代码:
if (Request["sumMoney"] != null)
{
Page.RegisterClientScriptBlock("refreshFrmProject", string.Format(@"
<script language='javascript'>
var frmProject = window.top.mainFrame.frmProject;
var trs = frmProject.document.getElementsByName('{0}');
var currentTr;
for(var i = 0; i < trs.length; i ++){
if (trs[i].guid == '{1}')
currentTr = trs[i];
}
frmProject.updateShowCurrentMoney(currentTr, {2});
frmProject.updateParentMoney(currentTr, {2});
</script>",
Request["wbs"], strWbsId, Request["sumMoney"]));
{
Page.RegisterClientScriptBlock("refreshFrmProject", string.Format(@"
<script language='javascript'>
var frmProject = window.top.mainFrame.frmProject;
var trs = frmProject.document.getElementsByName('{0}');
var currentTr;
for(var i = 0; i < trs.length; i ++){
if (trs[i].guid == '{1}')
currentTr = trs[i];
}
frmProject.updateShowCurrentMoney(currentTr, {2});
frmProject.updateParentMoney(currentTr, {2});
</script>",
Request["wbs"], strWbsId, Request["sumMoney"]));
运行后提示“输入字符串的格式不正确。”
郁闷了好久。。。后来经过一同事的帮助,终于知道为什么错了
原来是for语句中的{}引起的。。。