【发布时间】:2023-04-06 07:48:02
【问题描述】:
在我的程序中,我有一个按钮单击,从那个 onclick 事件中,我正在调用一种方法来进行某些文本框验证。代码是:
protected void btnupdate_Click(object sender, EventArgs e)
{
CheckValidation();
//Some other Code
}
public void CheckValidation()
{
if (txtphysi.Text.Trim() == "")
{
lblerrmsg.Visible = true;
lblerrmsg.Text = "Please Enter Physician Name";
return;
}
//Some other Code
}
这里如果txtphysi.text 为空那么它进入循环并使用return 然后它仅来自CheckValidation() 方法并在btnupdate_Click 事件中继续,但这里我想在btnupdate_Click 中停止执行过程还。我该怎么做?
【问题讨论】:
-
认为 "" 是 String.Empty 并且与 null 不同