0

我尝试通过下拉列表批准文件...

当我选择批准/拒绝/待定然后我有提交按钮当我点击按钮文件将批准/拒绝...我应该在提交按钮上编码什么?

这是下拉列表的代码

 protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddl = sender as DropDownList;

        GridViewRow row = (GridViewRow)ddl.NamingContainer;
        if (ddl.SelectedValue == "Approved")
        {
            using (SqlConnection con = new 
             SqlConnection(ConfigurationManager.ConnectionStrings
                ["mydms"].ConnectionString))
            {
                try
                {
                    con.Open();
                    string selectedValue = ((DropDownList)
                   (row.FindControl("DropDownList4"))).SelectedValue;
                    //int rowindex = Convert.ToInt32(e.CommandArgument);
                    SqlCommand cmd = new SqlCommand("approved", con);
                    docc.approve(Convert.ToInt32(Session["UserID"]),
                      Convert.ToInt32(Session["DocID"]), 
                  Convert.ToInt32(Session["ApproveID"]), 
                   Convert.ToString(Session["Login2"]));
                    int result = cmd.ExecuteNonQuery();
                    if (result != 0)
                    {
                        GrdFileApprove.DataBind();
                    }
                }


                catch
                {
                    apfi.Text = "Not Approve";



                }
                finally
                {
                    con.Close();
                }
            }
        }
        else if (ddl.SelectedValue == "Reject")
        {
            using (SqlConnection con = new 
    SqlConnection(ConfigurationManager.ConnectionStrings

           ["mydms"].ConnectionString))
            {
                try
                {
                    con.Open();
                    string selectedValue = ((DropDownList)
                      (row.FindControl("DropDownList4"))).SelectedValue;
                    //int rowindex = Convert.ToInt32(e.CommandArgument);
                    SqlCommand cmd = new SqlCommand("approved", con);
                    docc.approve(Convert.ToInt32(Session["UserID"]), 
                Convert.ToInt32(Session["DocID"]), 
             Convert.ToInt32(Session["ApproveID"]), 
               Convert.ToString(Session["Login2"]));
                    int result = cmd.ExecuteNonQuery();
                    if (result != 0)
                    {
                        GrdFileApprove.DataBind();
                    }
                }


                catch
                {
                    apfi.Text = "Rejct";
                }
                finally
                {
                    con.Close();
                }
            }
        }
    }

任何解决方案?

4

0 回答 0