0

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();
                }
            }
        }
    }
2
Contributors
1
Reply
16
Views
4 Years
Discussion Span
Last Post by LastMitch
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.