public void DataBindGrid() { List <Models.Salas> listRequisicoes = SalasDAO.GetSalas(); gvSalaList.DataSource = listRequisicoes; gvSalaList.DataBind(); }
protected void gvEquipList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Equip Equip = EquipDAO.GetEquipByID(Convert.ToInt32(e.Row.Cells[0].Text)); if (Equip.disp == false) { ((CheckBox)e.Row.FindControl("chbxDisponivel")).Checked = false; } else { ((CheckBox)e.Row.FindControl("chbxDisponivel")).Checked = true; } DropDownList ddlCat = (DropDownList)e.Row.FindControl("ddlCat"); ddlCat.DataSource = CatDAO.GetCats(); ddlCat.DataValueField = "id_cat"; ddlCat.DataTextField = "Nome"; ddlCat.DataBind(); ddlCat.SelectedValue = Equip.id_cat.ToString(); DropDownList ddlSala = (DropDownList)e.Row.FindControl("ddlSala"); ddlSala.DataSource = SalasDAO.GetSalas(); ddlSala.DataValueField = "id_sala"; ddlSala.DataTextField = "nome_sala"; ddlSala.DataBind(); ddlSala.SelectedValue = Equip.id_sala.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ddlCat.DataSource = CatDAO.GetCats(); ddlCat.DataValueField = "id_cat"; ddlCat.DataTextField = "Nome"; ddlCat.DataBind(); ddlSala.DataSource = SalasDAO.GetSalas(); ddlSala.DataValueField = "id_sala"; ddlSala.DataTextField = "nome_sala"; ddlSala.DataBind(); } }