Ejemplo n.º 1
0
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        try
        {
            AutocompletarService dbws = new AutocompletarService();

            DataTable dt = dbws.get_List_Ine(Convert.ToString(ddlEstados_Cat.SelectedValue), Convert.ToString(txtClaveE.Text));
            //txtClaveE.Text = dt.Rows[0]["CVE"].ToString();
            txtNombre.Text     = dt.Rows[0]["NOMBRE"].ToString();
            txtApellidoPa.Text = dt.Rows[0]["PATERNO"].ToString();
            txtApellidoMa.Text = dt.Rows[0]["MATERNO"].ToString();
            txtCalle.Text      = dt.Rows[0]["calle"].ToString();
            txtColonia.Text    = dt.Rows[0]["colonia"].ToString();
            txtNumE.Text       = dt.Rows[0]["num_exterior"].ToString();
            txtNumeroI.Text    = dt.Rows[0]["INT"].ToString();
            txtCodigo.Text     = Convert.ToInt32(dt.Rows[0]["CP"]).ToString().Trim();
            txtseccion.Text    = dt.Rows[0]["seccion"].ToString().Trim();
            txtMunicipio.Text  = dt.Rows[0]["municipio"].ToString();
            //txtFechaN.Text = Convert.ToDateTime(dt.Rows[0]["FechaN"]).ToString("yyyy-MM-dd").TrimEnd();
            string nombreCom = dt.Rows[0]["Nombre_comp"].ToString();
            if (nombreCom != "")
            {
                string nombre = Convert.ToString(dt.Rows[0]["Nombre_comp"]);
                using (SqlConnection con = new SqlConnection(strConnString))
                {
                    SqlCommand com = new SqlCommand("Select nombre_comp, partido_afil from tbl_PartidoNacional where nombre_comp='" + nombre + "'", con);
                    com.CommandType = CommandType.Text;
                    con.Open();
                    SqlDataReader registro2 = com.ExecuteReader();
                    if (registro2.Read())
                    {
                        txtClaveE.Enabled     = true;
                        txtNombre.Enabled     = true;
                        txtApellidoPa.Enabled = true;
                        txtApellidoMa.Enabled = true;
                        //txtFechaN.Enabled = true;
                        txtTelefono.Enabled   = true;
                        txtAfiliacion.Enabled = true;
                        txtCalle.Enabled      = true;
                        txtNumE.Enabled       = true;
                        txtNumeroI.Enabled    = true;
                        txtCodigo.Enabled     = true;
                        txtMunicipio.Enabled  = true;
                        txtColonia.Enabled    = true;
                        txtseccion.Enabled    = true;

                        txtAfiliacion.Text = registro2["partido_afil"].ToString().TrimEnd();
                    }
                    else
                    {
                        txtAfiliacion.Text = "";
                    }
                }
            }
            else
            {
            }


            string seccion = txtseccion.Text.ToString();
        }
        catch
        {
        }


        ClientScript.RegisterStartupScript(this.GetType(), "Popup", "$('#Asignaciones').modal('show')", true);
    }