有两个if块条件,每个条件都带有内部if块,通过满足第一个if块条件为true,控件应转到内部if块,这永远不会发生。任何帮助,请
if (string.IsNullOrEmpty(this.hfMonthID.Value.ToString()))
{
foreach (GridViewRow row in gvNewRecords.Rows)
{
if (row.Cells[2].Text == ddlFees.SelectedValue.ToString())
{
lblMessage.Text = "Fee is already added";
upMessage.Update();
return;
}
}
}
if (!string.IsNullOrEmpty(this.hfMonthID.Value.ToString()))
{
foreach (GridViewRow row in gvNewRecords.Rows)
{
if (row.Cells[1].Text == this.hfMonthID.Value.ToString())
{
lblMessage.Text = "Fee for this month is already added";
upMessage.Update();
return;
}
}
}