protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { if (SegurancaUsuario.ObterUsuario() != null) { /* var child = this.ContentPlaceHolder1.Page.GetType().FullName; if (!child.Contains("login")) { Response.Redirect("~/WebPage/Login.aspx"); return; } */ X.Js.AddScript("$('#liLogin').remove();$('span.t', $('#liGerenciar')).html('Gerenciar Conta').width(100); "); X.Js.AddScript("$('span.t', $('#liSair')).html('Sair').width(50).parent().click(function() { App.direct.SairUsuario(); });"); }else X.Js.AddScript("$('#liGerenciar').remove();$('#liSair').remove();"); string json = ""; using(var repositorio = new Repositorio()) json = TelaUtil.ToJson(repositorio.SelectAll<CategoriaProduto>().Select(x => new { ID = x.Id, Nome = x.Nome })); X.Js.AddScript(string.Format("upCategoria('{0}');", json)); } }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest) { string path = Request.Url.AbsoluteUri.Remove(Request.Url.AbsoluteUri.IndexOf(Request.Url.AbsolutePath)) + "/resources/images/produtos/small"; var store = this.GridPanel1.GetStore(); using(var repo = new Repositorio()) { var l = repo.SelectAll<Produto>().Select(x => new {Id = x.Id, nome = x.Nome, url = Path.Combine(path, x.Imagem)}); store.DataSource = l; } store.DataBind(); } }
private void RefreshGrid(Repositorio repo) { var l = repo.SelectAll<Produto>().Select(x => new { Id = x.Id, Nome = x.Nome, Preco = x.Casco == null ? -1 : x.Casco.Preco }); this.Store1.DataSource = l; this.Store1.DataBind(); }