如果条件被跳过

时间:2019-05-16 07:58:21

标签: c# asp.net

有两个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;
         }
      }
   }

0 个答案:

没有答案