-2

当文档被批准一次时,我试图隐藏一行或禁用下拉列表。此代码执行批准/拒绝/待定。现在,我想这样做,以便当管理员批准一次文档时,当他/她再次登录时,他们应该无法再次批准/拒绝相同的文档。这是我的 asp.net 代码:

protected void Button1_Click(object sender, EventArgs e)
{
   string connStr = 
         ConfigurationManager.ConnectionStrings["mydms"].ConnectionString;
   SqlConnection mySQLconnection = new SqlConnection(connStr);
   if (mySQLconnection.State == ConnectionState.Closed)
   {
      mySQLconnection.Open();
   }

   foreach (GridViewRow row in GrdFileApprove.Rows)
   {
      if (row.RowType == DataControlRowType.DataRow)
      {
         DropDownList DropDownListcontrol = row.FindControl("DropDownList4") as 
            DropDownList;

         SqlCommand cmd = new SqlCommand("approveddd", mySQLconnection);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@DocID", SqlDbType.Int).Value = 
         Convert.ToInt32((row.Cells[1].Text));

         cmd.Parameters.Add("@ApproveID", SqlDbType.Int).Value = 
         Convert.ToInt32(DropDownListcontrol.SelectedValue);
         cmd.Parameters.Add("@ApproveBy", SqlDbType.VarChar, 50).Value =
            (Session["Login2"]);

         cmd.ExecuteNonQuery(); 
      }

      else
      {
         apfi.Text = "Error";
      }
   }

   if (mySQLconnection.State == ConnectionState.Open)
   {
      mySQLconnection.Close();
   }

我该怎么做呢?

4

1 回答 1

1

隐藏下拉菜单:

DropDownList1.Visible = false;

禁用下拉菜单:

DropDownList1.Enabled = false;
于 2013-10-21T20:04:24.823 回答