无效的表达式术语'else'| ;预期 [英] Invalid expression term 'else'| ; expected
问题描述
虽然我在代码中进行了必要的更改,例如在单击错误时添加大括号,分号和无红线。我仍然得到这两个错误并阻止我运行解决方案。请帮助我还需要做些什么来纠正它。我被给了这个代码来审查它,我被困在这里
我尝试过:
Though I made the necessary changes in the code like adding braces,semicolon and no red line when clicking on the error. I still get this two errors and preventing me to run the solution. Please assist me what else has to be done to rectify it. I was given this codes to review it and I'am stuck here
What I have tried:
if(very big code)
{
%>
<%
}
else if (ViewState["OfferID"].ToString() == "2521"){
%>
<table cellpadding="0" cellspacing="0" width="100%" border="0"></table>
<%
}
else if (ViewState["OfferID"].ToString() == "2362")
{
%>
<table cellpadding="0" cellspacing="0" width="700px" border="0"></table>
<%
}
else if (ViewState["OfferID"].ToString() == "1839" || ViewState["OfferID"].ToString() == "1952")
{
%>
<table cellpadding="0" cellspacing="0" width="880px" border="0"></table>
<%
}
else if (ViewState["OfferID"].ToString() == "2015" || ViewState["OfferID"].ToString() == "2014")
{
%>
<table cellpadding="0" cellspacing="0" width="744px" border="0"></table>
<%
}
else
{
%>
<table cellpadding="0" cellspacing="0" width="744px" border="0"></table>
<%
}
%><table cellpadding="0" cellspacing="0" width="644px" border="0" style="padding: 15px"></table>
推荐答案
为什么不将viewstate值存储在var中并使用它?
检查你必须错过的大括号才能关闭一个。
if btw中的代码是什么?
Why don't you store the viewstate value in a var and use it?
Check the braces you must have missed to close one.
What is very big code in the if btw ?
波浪括号匹配,这不是问题所在。你有一个无与伦比的%>在末尾。否则,我会检查非常大的代码是否正确。
The wavy braces match so that is not the problem. You do have an unmatched "%>" at the end. Otherwise, I would check that the "very big code" is correct.
表达式无效术语'其他'| ;预期
Invalid expression term 'else'| ; expected
在寻求帮助时,有一项有用的技巧:提供有用的信息。
如果仔细观察,你会发现编译器也告诉你发现错误的地方。
更新问题并在代码中添加注释以显示编译器抱怨的位置。
When asking for help, there is a useful skill: giving useful information.
If you look carefully, you will see that the compiler also tells you where it found the error.
Update the question and put a comment in code to show where the compiler complain.
这篇关于无效的表达式术语'else'| ;预期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!