コード例 #1
0
        protected void Button4_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("ID_Producto");
            dt.Columns.Add("Descripcion");
            dt.Columns.Add("Precio");
            dt.Columns.Add("Cantidad");
            dt.Columns.Add("Total");
            DataRow dr = null;

            foreach (GridViewRow row in GridView1.Rows)
            {
                CheckBox chkitem = (CheckBox)(row.FindControl("CheckItem"));
                if (chkitem.Checked)
                {
                    dr = dt.NewRow();
                    dr["ID_Producto"] = row.Cells[0].Text.ToString();
                    dr["Descripcion"] = row.Cells[1].Text.ToString();
                    dr["Precio"]      = row.Cells[2].Text.ToString();
                    dr["Cantidad"]    = row.Cells[3].Text.ToString();
                    dr["Total"]       = row.Cells[4].Text.ToString();
                    dt.Rows.Add(dr);
                    Session["tablaitemcredito"] = dt;
                    datos.EditarCreditoXitem(Convert.ToInt32(row.Cells[6].Text));
                    datos.InsertarAbonoCredito2(Convert.ToDecimal(row.Cells[2].Text), 0, Convert.ToInt32(row.Cells[7].Text), Convert.ToInt32(row.Cells[6].Text));
                }
            }
            nit    = Label1.Text;
            nombre = Label2.Text;

            pendiente   = TextBox2.Text;
            Label7.Text = "Items cancelado con exito!";
            SqlDataSource1.SelectParameters["NIT"].DefaultValue = TextBox1.Text;
            SqlDataSource1.DataBind();
            SqlDataSource2.DataBind();
            Button2.Enabled = false;
            Response.Write("<script>window.open('ImpresionCreditoPagos.aspx','Titulo', 'height=300','width=300')</script>");
        }