protected override void Fill() { try { CurrentUser = new SPA.User(Context.User.Identity.Name); //Action.Write(string.Format("TrngModule.ascx CurrentUser.ID: {0}", CurrentUser.ID), "debug"); DataView dv = new DataView(TrngModule.Items(CurrentUser.ID)); dv.Sort = "DisplayIndex"; dv.RowFilter = "IsActive = 1"; gvData.DataSource = dv; gvData.DataBind(); } catch (Exception ex) { SPA.Error.WriteError(ex); if (ShowDebug) { lblErrorMessage.Text = ex.ToString(); } } }
protected override void Fill() { try { DataTable dt = TrngModule.Items(); foreach (DataRow dr in dt.Rows) { dr["URL"] = SPContext.Current.Web.Url + dr["URL"].ToString(); dr["ImageURL"] = SPContext.Current.Web.Url + dr["ImageURL"].ToString(); } string rowFilter = "IsActive = 1"; string sort = "DisplayIndex ASC, Name ASC"; Table tbl = new Table(); tbl.Width = Unit.Percentage(100); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Select(rowFilter, sort)) { tbl.Controls.Add(ModuleRow(dr)); } this.Controls.Add(tbl); } else { Label lbl = new Label(); lbl.CssClass = "ms-vb"; if (dt.Rows.Count == 0) { lbl.Text = "There are currently no modules to display.<br>Modules will be displayed once they are installed and configured."; } else { lbl.Text = "There are currently no active modules to display.<br>Modules will be displayed once they are installed and configured."; } this.Controls.Add(lbl); } } catch (Exception ex) { SPA.Error.WriteError(ex); if (ShowDebug) { lblErrorMessage.Text = ex.ToString(); } } }