protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { LblIdInsOrg.Text = Session["IdInsOrg"].ToString(); LblIdInsProd.Text = Session["IdInsProd"].ToString(); LblIdUsuario.Text = Session["IdUser"].ToString(); //LblEtapa.Text = Session["Etapa"].ToString(); Datos_Org_ENCABEZADO(); Cargar_COMBO(); /*************************************/ DataTable dtListaPartida = new DataTable(); dtListaPartida.Columns.AddRange(new DataColumn[9] { new DataColumn("Id_Fenologia"), new DataColumn("Face_Fenologia"), new DataColumn("Valor1"), new DataColumn("Valor2"), new DataColumn("Valor3"), new DataColumn("Valor4"), new DataColumn("Valor5"), new DataColumn("Valor6"), new DataColumn("Valor7") }); GVRendMaiz.DataSource = dtListaPartida; GVRendMaiz.DataBind(); Session["datos"] = dtListaPartida; } } catch { Response.Redirect("~/About.aspx"); } }
protected void BtnRegistrar_Click(object sender, EventArgs e) { if (TxtNumMazorcas.Text != "") { if (TxtDistHileras.Text != "") { if (TxtNumMazorm2.Text != "") { if (TxtGranosMazorc.Text != "") { if (TxtMilGranos.Text != "") { if (TxtProcentHumendad.Text != "") { string aux = "NO"; DataTable dt = Session["datos"] as DataTable; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i][0].ToString() == DDLFaceFenologica.SelectedValue) { aux = "SI"; } } if (aux == "NO") { //DataTable dt = Session["datos"] as DataTable; DataRow row = dt.NewRow(); row["Id_Fenologia"] = DDLFaceFenologica.SelectedValue; row["Face_Fenologia"] = DDLFaceFenologica.SelectedItem.Text; row["Valor1"] = TxtNumMazorcas.Text; row["Valor2"] = TxtDistHileras.Text; row["Valor3"] = TxtNumMazorm2.Text; row["Valor4"] = TxtGranosMazorc.Text; row["Valor5"] = TxtMilGranos.Text; row["Valor6"] = TxtProcentHumendad.Text; row["Valor7"] = LblTonHa.Text; dt.Rows.Add(row); GVRendMaiz.DataSource = dt; GVRendMaiz.DataBind(); Session["datos"] = dt; BtnEnviar.Visible = true; BtnCancelar.Visible = true; LblMsj1.Text = string.Empty; Linpiar_CAMPOS(); } else { LblMsj1.Text = "Ya registro la face Fenologica que selecciono"; } } else { LblMsj1.Text = "ERROR porcentage humedad"; } } else { LblMsj1.Text = "ERROR mil granos"; } } else { LblMsj1.Text = "ERROR granos mazorca"; } } else { LblMsj1.Text = "ERROR granos mazorca m2"; } } else { LblMsj1.Text = "ERROR distancia entre hileras"; } } else { LblMsj1.Text = "ERROR numero de mazorcas"; } }