我在aspx.cs里定义了全局变量,但是aspx文件中调用却提示我不存在
namespaceJd_Text{publicstaticclassDefault:System.Web.UI.Page{publicstringret;publicst...
namespace Jd_Text
{
public static class Default : System.Web.UI.Page
{
public string ret;
public string fh2;
public string kk;
protected void Page_Load(object sender, EventArgs e)
{
double num1 = Class1.Todou(Class1.get("num1"));
string fh1 = Class1.get("fh1");
kk = Class1.get("kk");
fh2 = Class1.get("fh2");
double num2 = Class1.Todou(Class1.get("num2"));
if (fh1 == "+")
{
ret = (num1 + num2).ToString();
}
if (fh1 == "-")
{
ret = (num1 - num2).ToString();
}
if (fh1 == "*")
{
ret = (num1 * num2).ToString();
}
if (fh1 == "/")
{
ret = (num1 / num2).ToString();
}
}
}
}
//////////////////////////////////
<input name="num1" id="num1" type="text" style="width:40px;" value="<%=ret %>"/> 展开
{
public static class Default : System.Web.UI.Page
{
public string ret;
public string fh2;
public string kk;
protected void Page_Load(object sender, EventArgs e)
{
double num1 = Class1.Todou(Class1.get("num1"));
string fh1 = Class1.get("fh1");
kk = Class1.get("kk");
fh2 = Class1.get("fh2");
double num2 = Class1.Todou(Class1.get("num2"));
if (fh1 == "+")
{
ret = (num1 + num2).ToString();
}
if (fh1 == "-")
{
ret = (num1 - num2).ToString();
}
if (fh1 == "*")
{
ret = (num1 * num2).ToString();
}
if (fh1 == "/")
{
ret = (num1 / num2).ToString();
}
}
}
}
//////////////////////////////////
<input name="num1" id="num1" type="text" style="width:40px;" value="<%=ret %>"/> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询