コード例 #1
0
        private void Carga_Grid()
        {
            DateTime Fecha;
            DataTable dt = new DataTable();
            dt.Columns.Add("Código", Type.GetType("System.String"));
            dt.Columns.Add("Mascota", Type.GetType("System.String"));
            dt.Columns.Add("Nombre de Mascota", Type.GetType("System.String"));
            dt.Columns.Add("Centro", Type.GetType("System.String"));
            dt.Columns.Add("Nombre Centro Atención", Type.GetType("System.String"));
            dt.Columns.Add("Fecha", Type.GetType("System.String"));
            WSGestion.WSGestion wsgest = new WSGestion.WSGestion();
            wsgest.Url = ConfigurationManager.AppSettings.Get("dirWs");
            List<WSGestion.MOD_Expediente> lista = wsgest.SEL_GRID_Expediente(centro, buscar).ToList();
            for (int i = 0; i < lista.Count; i++)
            {
                dt.Rows.Add();
                dt.Rows[dt.Rows.Count - 1]["Código"] = lista[i].EXP_id_expediente;
                dt.Rows[dt.Rows.Count - 1]["Mascota"] = lista[i].EXP_id_mascota;
                dt.Rows[dt.Rows.Count - 1]["Nombre de Mascota"] = lista[i].MAS_nombre;
                dt.Rows[dt.Rows.Count - 1]["Centro"] = lista[i].EXP_id_centro_atencion;
                dt.Rows[dt.Rows.Count - 1]["Nombre Centro Atención"] = lista[i].CEA_nombre;
                Fecha = Convert.ToDateTime(lista[i].EXP_fecha_creacion);
                dt.Rows[dt.Rows.Count - 1]["Fecha"] = Fecha.ToString("dd/MM/yyyy hh:mm tt");

            }
            gridview.DataSource = dt;
            gridview.DataBind();

            codigo_seleccionado = 0;
        }