protected void llenarvacio() { UltraWebGrid2.ResetColumns(); UltraWebGrid2.DataBind(); UltraWebGrid2.DisplayLayout.ScrollBar = ScrollBar.Never; UltraWebGrid2.Columns.Add("Centro trabajo"); UltraWebGrid2.Columns.Add("Banco"); UltraWebGrid2.Columns.Add("Fecha inicio"); UltraWebGrid2.Columns.Add("Fecha fin"); UltraWebGrid2.Columns.Add("Autorizado"); UltraWebGrid2.Columns.Add("Autoriza"); UltraWebGrid2.Columns.Add("Activo"); UltraWebGrid2.Columns[0].Header.Caption = "Centro de trabajo"; UltraWebGrid2.Columns[1].Header.Caption = "Banco"; UltraWebGrid2.Columns[2].Header.Caption = "Fecha inicio"; UltraWebGrid2.Columns[3].Header.Caption = "Fecha fin"; UltraWebGrid2.Columns[4].Header.Caption = "Autorizado"; UltraWebGrid2.Columns[5].Header.Caption = "Autoriza"; UltraWebGrid2.Columns[6].Header.Caption = "Activo"; UltraWebGrid2.Columns[0].Header.Style.Wrap = true; UltraWebGrid2.Columns[0].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[1].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[2].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[3].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[4].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[5].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[6].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[0].Width = 100; UltraWebGrid2.Columns[1].Width = 65; UltraWebGrid2.Columns[4].Width = 75; UltraWebGrid2.Columns[5].Width = 90; UltraWebGrid2.Columns[6].Width = 70; }
private void PerformGetAllData(string strCommandText) { UltraWebGrid2.ResetColumns(); UltraWebGrid2.ResetBands(); ConnectStr = (new igFunctions.DB().getConStr()); SqlConnection Con = new SqlConnection(ConnectStr); SqlCommand cmdCusData = new SqlCommand(strCommandText, Con); SqlDataAdapter Adap = new SqlDataAdapter(); Con.Open(); Adap.SelectCommand = cmdCusData; Adap.Fill(ds, "AllData"); Con.Close(); UltraWebGrid2.DataSource = ds.Tables["AllData"].DefaultView; UltraWebGrid2.DataBind(); }
protected void btnBuscar_click(object sender, EventArgs e) { try { DropDownList cmbPlanta = ((DropDownList)Page.Master.FindControl("cmbPlanta")); svcSCPP.SCPPClient svc = new svcSCPP.SCPPClient(); int planta = int.Parse(cmbPlanta.SelectedValue); int centroTrab = int.Parse(cmbCentroTrabajo.SelectedValue); int maquina = int.Parse(cmbMaquina.SelectedValue); int active = Convert.ToInt32(ddlActivos.SelectedValue); List <Common.SolutionEntityFramework.BaseSolutionEntity> Lista = svc.ObtenerConfiguracionBanco(planta, centroTrab, maquina, active); UltraWebGrid2.DataSource = Lista; if (Lista.Count <= 0) { llenarvacio(); } else { UltraWebGrid2.ResetColumns(); UltraWebGrid2.DataBind(); UltraWebGrid2.DisplayLayout.ScrollBar = ScrollBar.Auto; UltraWebGrid2.Columns[0].Header.Caption = "Centro de trabajo"; UltraWebGrid2.Columns[1].Header.Caption = "Banco"; UltraWebGrid2.Columns[2].Header.Caption = "Límite de vaciadas"; UltraWebGrid2.Columns[3].Header.Caption = "Vaciadas acumuladas"; UltraWebGrid2.Columns[4].Header.Caption = "Fecha inicio"; UltraWebGrid2.Columns[5].Header.Caption = "Fecha fin"; UltraWebGrid2.Columns[6].Header.Caption = "Autorizado"; UltraWebGrid2.Columns[7].Header.Caption = "Autoriza"; UltraWebGrid2.Columns[8].Header.Caption = "Activo"; UltraWebGrid2.Columns[9].Header.Caption = "CodCT"; UltraWebGrid2.Columns[10].Header.Caption = "CodMaquina"; UltraWebGrid2.Columns[11].Header.Caption = "CodUsuarioAutoriza"; UltraWebGrid2.Columns[12].Header.Caption = "CodUsuarioAlta"; UltraWebGrid2.Columns[13].Header.Caption = "CodConfigBanco"; UltraWebGrid2.Columns[14].Header.Caption = "ExceptionMessage"; UltraWebGrid2.Columns[0].Header.Style.Wrap = true; UltraWebGrid2.Columns[2].Header.Style.Wrap = true; UltraWebGrid2.Columns[3].Header.Style.Wrap = true; UltraWebGrid2.Columns[6].Width = 80; UltraWebGrid2.Columns[7].Width = 130; UltraWebGrid2.Columns[8].Width = 70; UltraWebGrid2.Columns[0].Width = 150; UltraWebGrid2.Columns[1].Width = 150; UltraWebGrid2.Columns[4].Width = 90; UltraWebGrid2.Columns[5].Width = 90; UltraWebGrid2.Columns[0].AllowResize = AllowSizing.Fixed; UltraWebGrid2.Columns[1].AllowResize = AllowSizing.Fixed; UltraWebGrid2.Columns[2].AllowResize = AllowSizing.Fixed; UltraWebGrid2.Columns[3].AllowResize = AllowSizing.Fixed; UltraWebGrid2.Columns[4].AllowResize = AllowSizing.Fixed; UltraWebGrid2.Columns[5].AllowResize = AllowSizing.Fixed; UltraWebGrid2.Columns[6].AllowResize = AllowSizing.Fixed; UltraWebGrid2.Columns[7].AllowResize = AllowSizing.Fixed; UltraWebGrid2.Columns[8].AllowResize = AllowSizing.Fixed; UltraWebGrid2.Columns[0].CellStyle.HorizontalAlign = HorizontalAlign.Left; UltraWebGrid2.Columns[1].CellStyle.HorizontalAlign = HorizontalAlign.Left; UltraWebGrid2.Columns[2].CellStyle.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[3].CellStyle.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[4].CellStyle.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[5].CellStyle.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[6].CellStyle.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[7].CellStyle.HorizontalAlign = HorizontalAlign.Left; UltraWebGrid2.Columns[8].CellStyle.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[0].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[1].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[2].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[3].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[4].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[5].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[6].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[7].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[8].Header.Style.HorizontalAlign = HorizontalAlign.Center; UltraWebGrid2.Columns[4].Format = "dd-MM-yyyy"; UltraWebGrid2.Columns[5].Format = "dd-MM-yyyy"; UltraWebGrid2.Columns[2].Hidden = true; UltraWebGrid2.Columns[3].Hidden = true; UltraWebGrid2.Columns[9].Hidden = true; UltraWebGrid2.Columns[10].Hidden = true; UltraWebGrid2.Columns[11].Hidden = true; UltraWebGrid2.Columns[12].Hidden = true; UltraWebGrid2.Columns[13].Hidden = true; UltraWebGrid2.Columns[14].Hidden = true; UltraWebGrid2.Width = 800; } } catch (Exception ex) { CallBackManager.AddScriptBlock(this.Page, WebAsyncRefreshPanel1, "<script type='text/javascript'>alert('No se encontraron datos');</script>"); } }