protected void ChangeView_Click(object sender, EventArgs e) { switch (avSelectedView.Text) { case "list": AssetViewRepeater.HeaderTemplate = Page.LoadTemplate("/Account/Templates/emptytemplate.ascx"); AssetViewRepeater.ItemTemplate = Page.LoadTemplate("/Account/Templates/av_list_template.ascx"); AssetViewRepeater.FooterTemplate = Page.LoadTemplate("/Account/Templates/emptytemplate.ascx"); AssetViewRepeater.DataSource = GetAssets(); AssetViewRepeater.DataBind(); break; case "detail": break; case "smtile": break; case "mdtile": break; case "lgtile": break; } }
protected void UpdateView(string view, object datasource = null) { if (datasource == null) { datasource = AssetController.GetAllAssets(); } switch (view) { case "list": AssetViewRepeater.HeaderTemplate = Page.LoadTemplate("/Account/Templates/av_default_header_template.ascx"); AssetViewRepeater.ItemTemplate = Page.LoadTemplate("/Account/Templates/av_default_template.ascx"); AssetViewRepeater.FooterTemplate = Page.LoadTemplate("/Account/Templates/av_default_footer_template.ascx"); AssetViewRepeater.DataSource = datasource; AssetViewRepeater.DataBind(); Session["CurrentAvView"] = avSelectedView.Text; break; case "detail": break; case "smtile": AssetViewRepeater.ItemTemplate = Page.LoadTemplate("/Account/Templates/av_list_template.ascx"); AssetViewRepeater.DataSource = datasource; AssetViewRepeater.DataBind(); Session["CurrentAvView"] = avSelectedView.Text; break; case "mdtile": AssetViewRepeater.HeaderTemplate = Page.LoadTemplate("/Account/Templates/av_header_template.ascx"); AssetViewRepeater.ItemTemplate = Page.LoadTemplate("/Account/Templates/av_sm_tile_template.ascx"); AssetViewRepeater.FooterTemplate = Page.LoadTemplate("/Account/Templates/av_footer_template.ascx"); AssetViewRepeater.DataSource = datasource; AssetViewRepeater.DataBind(); Session["CurrentAvView"] = avSelectedView.Text; break; case "lgtile": AssetViewRepeater.HeaderTemplate = Page.LoadTemplate("/Account/Templates/av_header_template.ascx"); AssetViewRepeater.ItemTemplate = Page.LoadTemplate("/Account/Templates/av_sm_tile_template.ascx"); AssetViewRepeater.FooterTemplate = Page.LoadTemplate("/Account/Templates/av_footer_template.ascx"); AssetViewRepeater.DataSource = datasource; AssetViewRepeater.DataBind(); Session["CurrentAvView"] = avSelectedView.Text; break; default: AssetViewRepeater.HeaderTemplate = Page.LoadTemplate("/Account/Templates/av_default_header_template.ascx"); AssetViewRepeater.ItemTemplate = Page.LoadTemplate("/Account/Templates/av_default_template.ascx"); AssetViewRepeater.FooterTemplate = Page.LoadTemplate("/Account/Templates/av_default_footer_template.ascx"); AssetViewRepeater.DataSource = datasource; AssetViewRepeater.DataBind(); Session["CurrentAvView"] = avSelectedView.Text; break; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.User.Identity.IsAuthenticated) { Response.Redirect("/Account/Login"); } AssetViewRepeater.HeaderTemplate = Page.LoadTemplate("/Account/Templates/av_header_template.ascx"); AssetViewRepeater.ItemTemplate = Page.LoadTemplate("/Account/Templates/av_sm_tile_template.ascx"); AssetViewRepeater.FooterTemplate = Page.LoadTemplate("/Account/Templates/av_footer_template.ascx"); AssetViewRepeater.DataSource = GetAssets(); AssetViewRepeater.DataBind(); // PlaceHolder lbl_UserName = this.Master.FindControl("RibbonBar") as PlaceHolder; //lbl_UserName.Visible = true; }