i try to approve documents through dropdownlist...

when i select approve/reject/pending then i have submit button when i click on button document will be approve/reject...what should i code on submit button??

here is the code of dropdown

 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();
                }
            }
        }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.