Example #1
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {

            //DropDownList drdList;
            //drdList = (DropDownList)(GridView1.Rows[e.RowIndex].Cells[10].FindControl("List_status"));
            //String n_solicitud = GridView1.DataKeys[e.RowIndex]["n_solicitud"].ToString();

            //solSolicitudesBO mysolSolicitudesBO = new solSolicitudesBO();
            //mysolSolicitudesBO.grabarStatus(n_solicitud,drdList.Text );



            DropDownList drdList;
            drdList = (DropDownList)(GridView1.Rows[e.RowIndex].Cells[10].FindControl("List_status"));
            String n_solicitud = GridView1.DataKeys[e.RowIndex]["n_solicitud"].ToString();

            String c_tipo = GridView1.DataKeys[e.RowIndex]["c_tipo"].ToString();
            String c_unidadNeg = GridView1.DataKeys[e.RowIndex]["c_unidadNeg"].ToString();

            solSolicitudesBO mysolSolicitudesBO = new solSolicitudesBO();
            mysolSolicitudesBO.grabarStatus(n_solicitud, drdList.Text, c_tipo, c_unidadNeg);




            //mySqlCommand.Parameters.Add("@order_id", SqlDbType.Int).Value = Convert.ToInt32(GridView1.DataKeys[e.RowIndex]["order_id"]);  
            //String n_solicitud = GridView1.Rows[e.RowIndex].Cells[1].Text;
            //TableCell  celda = GridView1.Rows[e.RowIndex].Cells[1];
            //celda.
            //String n_solicitud2 = GridView1.SelectedRow.Cells[1].Text;

            int i;
            i = 1;
            i = i+1;


            //// string variable to store the connection string  
            //// defined in appsettings section of web.config file.  
            //string connStr = ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString;
            //// object created for SqlConnection Class.  
            //SqlConnection mySQLconnection = new SqlConnection(connStr);
            //// if condition that can be used to check the sql connection  
            //// whether it is already open or not.  
            //if (mySQLconnection.State == ConnectionState.Closed)
            //{
            //    mySQLconnection.Open();
            //}
            //// SQL Command object to pass the SQL query for updating the data of tbl_orders table.  
            //SqlCommand mySqlCommand = new SqlCommand("update tbl_orders set order_status_id=@order_status_id where order_id=@order_id", mySQLconnection);
            
            //// SQL command input parameter to set the new value for order_status_id  
            //mySqlCommand.Parameters.Add("@order_status_id", SqlDbType.Int).Value = drdList.SelectedValue;
            //// SQL command input parameter as order_id whose corresponding value for order_status_id is to be set  
            //mySqlCommand.Parameters.Add("@order_id", SqlDbType.Int).Value = Convert.ToInt32(GridView1.DataKeys[e.RowIndex]["order_id"]);
            //// Execute the SQL query to update the tbl_orders  
            //mySqlCommand.ExecuteNonQuery();
            //// if condition that can be used to check the sql connection  
            //// if it is open then close it.  
            //if (mySQLconnection.State == ConnectionState.Open)
            //{
            //    mySQLconnection.Close();
            //}
            //GridView1.EditIndex = -1;
            //bindGridView();


        }