/// <summary> /// Handles the RowDataBound event of the ModuleTabsGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewRowEventArgs"/> instance containing the event data.</param> private void ModuleTabsGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { GridView moduleSettingsGrid = (GridView)e.Row.FindControl("ModuleSettingsGrid"); GridView tabModuleSettingsGrid = (GridView)e.Row.FindControl("TabModuleSettingsGrid"); HiddenField moduleIdHiddenField = (HiddenField)e.Row.FindControl("ModuleIdHiddenField"); HiddenField tabModuleIdHiddenField = (HiddenField)e.Row.FindControl("TabModuleIdHiddenField"); DashboardItem tabModuleSettingsItem = (DashboardItem)e.Row.FindControl("TabModuleSettingsItem"); DashboardItem moduleSettingsItem = (DashboardItem)e.Row.FindControl("ModuleSettingsItem"); Utility.LocalizeGridView(ref tabModuleSettingsGrid, this.LocalResourceFile); Utility.LocalizeGridView(ref moduleSettingsGrid, this.LocalResourceFile); using (IDataReader tabModuleSettings = DataProvider.Instance().GetTabModuleSettings(Convert.ToInt32(tabModuleIdHiddenField.Value, CultureInfo.InvariantCulture))) { tabModuleSettingsGrid.DataSource = tabModuleSettings; tabModuleSettingsGrid.DataBind(); tabModuleSettingsItem.SetValue(tabModuleSettingsGrid.Rows.Count); if (tabModuleSettingsGrid.Rows.Count > 0) { this.ModuleTabsGrid.Columns[4].Visible = true; } } using (IDataReader moduleSettings = DataProvider.Instance().GetModuleSettings(Convert.ToInt32(moduleIdHiddenField.Value, CultureInfo.InvariantCulture))) { moduleSettingsGrid.DataSource = moduleSettings; moduleSettingsGrid.DataBind(); moduleSettingsItem.SetValue(moduleSettingsGrid.Rows.Count); if (moduleSettingsGrid.Rows.Count > 0) { this.ModuleTabsGrid.Columns[5].Visible = true; } } } }
/// <summary> /// Sets up the date range controls to the default of one month ago to today, if the date range is not already set. /// </summary> /// <param name="dashboardItem">A <see cref="DashboardItem"/> with a date range</param> protected static void SetupDateRangeControls(DashboardItem dashboardItem) { dashboardItem.BeginDate = dashboardItem.BeginDate ?? DateTime.Today.AddMonths(-1); dashboardItem.EndDate = dashboardItem.EndDate ?? DateTime.Today; }