protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { SessoesStatusDAL sessoesStatusDAL = new SessoesStatusDAL(); DropDownList ddlStatus = (DropDownList)e.Row.FindControl("ddlStatus"); ddlStatus.DataSource = sessoesStatusDAL.Listar(); ddlStatus.DataTextField = "Nome"; ddlStatus.DataValueField = "ID"; ddlStatus.AutoPostBack = true; ddlStatus.DataBind(); ddlStatus.Items.Insert(0, new ListItem("<--Selecione-->", string.Empty)); //Texto Inicial do combo //Insere as imagens referente a cada status Image ImgStatus = (Image)e.Row.FindControl("ImgStatus"); if (Convert.ToString(DataBinder.Eval(e.Row.DataItem, "idSessoesStatus")) == "1") { ImgStatus.ImageUrl = "~/Template/Img/Flg_azul.gif"; } if (Convert.ToString(DataBinder.Eval(e.Row.DataItem, "idSessoesStatus")) == "2") { ImgStatus.ImageUrl = "~/Template/Img/Flg_verde.gif"; } if (Convert.ToString(DataBinder.Eval(e.Row.DataItem, "idSessoesStatus")) == "3") { ImgStatus.ImageUrl = "~/Template/Img/Flg_amerelo_Escuro.gif"; } if (Convert.ToString(DataBinder.Eval(e.Row.DataItem, "idSessoesStatus")) == "4") { ImgStatus.ImageUrl = "~/Template/Img/Flg_vermelho.gif"; } } }
public void MontaComboStatus() { SessoesStatusDAL sessoesStatusDAL = new SessoesStatusDAL(); ddlStatusAgendamento.DataSource = sessoesStatusDAL.Listar(); ddlStatusAgendamento.DataTextField = "Nome"; ddlStatusAgendamento.DataValueField = "ID"; ddlStatusAgendamento.DataBind(); ddlStatusAgendamento.Items.Insert(0, new ListItem("<--Selecione-->", string.Empty)); //Texto Inicial do combo }
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { SessoesStatusDAL sessoesStatusDAL = new SessoesStatusDAL(); DropDownList ddlStatus = (DropDownList)e.Row.FindControl("ddlStatus"); ddlStatus.DataSource = sessoesStatusDAL.Listar(); ddlStatus.DataTextField = "Nome"; ddlStatus.DataValueField = "ID"; ddlStatus.AutoPostBack = true; ddlStatus.DataBind(); ddlStatus.Items.Insert(0, new ListItem("<--Selecione-->", string.Empty)); //Texto Inicial do combo } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { SessoesStatusDAL sessoesStatusDAL = new SessoesStatusDAL(); DropDownList ddlStatus = (DropDownList)e.Row.FindControl("ddlStatus"); ddlStatus.DataSource = sessoesStatusDAL.Listar(); ddlStatus.DataTextField = "Nome"; ddlStatus.DataValueField = "ID"; ddlStatus.AutoPostBack = true; ddlStatus.DataBind(); ddlStatus.Items.Insert(0, new ListItem("<--Selecione-->", string.Empty)); //Texto Inicial do combo //Insere as imagens referente a cada status Image ImgStatus = (Image)e.Row.FindControl("ImgStatus"); if (Convert.ToString(DataBinder.Eval(e.Row.DataItem, "idSessoesStatus")) == "1") ImgStatus.ImageUrl = "~/Template/Img/Flg_azul.gif"; if (Convert.ToString(DataBinder.Eval(e.Row.DataItem, "idSessoesStatus")) == "2") ImgStatus.ImageUrl = "~/Template/Img/Flg_verde.gif"; if (Convert.ToString(DataBinder.Eval(e.Row.DataItem, "idSessoesStatus")) == "3") ImgStatus.ImageUrl = "~/Template/Img/Flg_amerelo_Escuro.gif"; if (Convert.ToString(DataBinder.Eval(e.Row.DataItem, "idSessoesStatus")) == "4") ImgStatus.ImageUrl = "~/Template/Img/Flg_vermelho.gif"; } }