0
Good afternoon , I need a help in that code.  he has taken time out however I do not see another way to get the data and insert in the form  


this is  ascx.cs

protected void gridListaPerfil_Bound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
var lbPerfilID = e.Row.FindControl(“lbPerfilID”) as Label;
var lbParceiro = e.Row.FindControl(“lbParceiro”) as Label;
var hfPerfilID = e.Row.FindControl(“hfPerfilID”) as HiddenField;
var hfParceiroID = e.Row.FindControl(“hfParceiroID”) as HiddenField;
var ddlGacs = e.Row.FindControl(“ddlGacs”) as DropDownList;
var ddlVisao = e.Row.FindControl(“ddlVisao”) as DropDownList;
var cb = e.Row.FindControl(“cb”) as CheckBox;

GacUsuarioBLL gacUsuarioBll = new GacUsuarioBLL(SPContext.Current.Web);
GacBaseBLL gacBaseBll = new GacBaseBLL(SPContext.Current.Web);
Acesso acesso = (Acesso)e.Row.DataItem;

cb.Checked = true;
lbParceiro.Text = acesso.Empresa.Title;
hfParceiroID.Value = acesso.Empresa.Id.ToString();
lbPerfilID.Text = acesso.Perfil.Title;
hfPerfilID.Value = acesso.Perfil.Id.ToString();

List<GacUsuario> gacs = gacUsuarioBll.ObterPorGacBase(gacBaseBll.ObterPorTipoPerfil(acesso.Perfil.Tipo).FirstOrDefault().Id).ToList();
gacs.ForEach(x =>
{
ddlGacs.Items.Add(new ListItem(x.Title, x.Id.ToString()));
});
ddlGacs.SelectedIndex = ddlGacs.Items.IndexOf(ddlGacs.Items.FindByValue(acesso.GacUsuario.Id.ToString()));

if (acesso.Perfil.Tipo == Perfil.TipoPerfil.AngariadorInterno)
{
ddlVisao.DataSource = Enum.GetNames(typeof(Acesso.VisaoTipoAcesso)).Where(x => x != Acesso.VisaoTipoAcesso.Prospect.ToString());
ddlVisao.DataBind();
ddlVisao.SelectedIndex = ddlVisao.Items.IndexOf(ddlVisao.Items.FindByValue(acesso.VisaoTipo.ToString()));
ddlVisao.Visible = true;
}
else
ddlVisao.Visible = false;
}
}



(Visited 20 times, 1 visits today)
Add a Comment