public void CarregarTimes() { DataView times = new DataView(time.BuscarTime()); times.Sort = this.SortExpression; dgTime.DataSource = times; dgTime.DataBind(); dgTime.Visible = (times.Count > 0); lbMensagem.Visible = (times.Count == 0); lbMensagem.Text = "Não existe nenhum time cadastrado."; }
public void Inicializar(int codTime) { this.CodTime = codTime; if (codTime == 0) { tbNome.Text = ""; tbSigla.Text = ""; imgIcone.Visible = false; lbOperacao.Text = "Incluir Time"; } else { DataRow registro = time.BuscarTime(codTime); if (registro != null) { tbNome.Text = "" + Convert.ToString(registro["nom_time"]); tbSigla.Text = "" + Convert.ToString(registro["sgl_time"]); imgIcone.Visible = true; imgIcone.ImageUrl = "../Images/Times/" + Convert.ToString(registro["dsc_icone"]); } lbOperacao.Text = "Alterar Time"; } }
protected void btPesquisar_Click(object sender, System.EventArgs e) { if (Page.IsValid) { DataTable times = time.BuscarTime(tbNome.Text); ddlTime.DataSource = times; ddlTime.DataValueField = "cod_time"; ddlTime.DataTextField = "nom_time"; ddlTime.DataBind(); if (times.Rows.Count == 1) { ddlTime.Items[0].Selected = true; } else { ddlTime.Items.Insert(0, new ListItem("Selecione...", "0")); } pnTime.Visible = true; } }