帮忙看一下这段c#代码有什么问题,提示说当前上下文中不存在名称lblStatus,这是什么问题…………谢了……
{staticstring[,]userList;fileOperationfs;protectedvoidPage_Load(objectsender,EventArg...
{
static string[,] userList;
fileOperation fs ;
protected void Page_Load(object sender, EventArgs e)
{
ArrayList r;
int i = 0;
if (!IsPostBack)
{
fs = new fileOperation();
r =fs.getAllUser() ;
userList=new string[r.Count,3];
foreach (string strout in r)
{
char[] ch = new char[] { ',' };//分隔条件
string[] str;
str = strout.Split(ch);
for (int j = 0; j < 3; j++)
{
userList[i, j] = str[j];
}
i = i + 1;
}
}
}
protected void btnRegister_Click(object sender, EventArgs e)
{
//判断用户名是否已经注册
for (int i = 0; i < userList.Length / 3; i++)
{
if (txtUserName.Text.Trim() == userList[i, 0])
{
lblStatus.Text = "此用户名已经注册!";
return;
}
}
}
protected void btnLogin_Click(object sender, EventArgs e)
{
Response.Redirect("login.aspx");
}
} 展开
static string[,] userList;
fileOperation fs ;
protected void Page_Load(object sender, EventArgs e)
{
ArrayList r;
int i = 0;
if (!IsPostBack)
{
fs = new fileOperation();
r =fs.getAllUser() ;
userList=new string[r.Count,3];
foreach (string strout in r)
{
char[] ch = new char[] { ',' };//分隔条件
string[] str;
str = strout.Split(ch);
for (int j = 0; j < 3; j++)
{
userList[i, j] = str[j];
}
i = i + 1;
}
}
}
protected void btnRegister_Click(object sender, EventArgs e)
{
//判断用户名是否已经注册
for (int i = 0; i < userList.Length / 3; i++)
{
if (txtUserName.Text.Trim() == userList[i, 0])
{
lblStatus.Text = "此用户名已经注册!";
return;
}
}
}
protected void btnLogin_Click(object sender, EventArgs e)
{
Response.Redirect("login.aspx");
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询