private void FillSettingsGrid() { try { SettingsDataTable = new DataTable(); DataSet SettingsDataSet = new DataSet(); SettingsDataTable = VSWebBL.SettingBL.SettingsBL.Ins.GetAllData(); if (SettingsDataTable.Rows.Count > 0) { //DataTable dtcopy = SettingsDataTable.Copy(); //dtcopy.PrimaryKey = new DataColumn[] { dtcopy.Columns["ID"] }; SettingsDataTable.PrimaryKey = new DataColumn[] { SettingsDataTable.Columns["sname"] }; } Session["Settings"] = SettingsDataTable; SettingsGridView.DataSource = SettingsDataTable; SettingsGridView.DataBind(); } catch (Exception ex) { if (ex.Message == "These columns don't currently have unique values.") { SettingsGridView.SettingsText.EmptyDataRow = "There are duplicate Settings entered in the database. Cannot display data. Delete the duplicates from backend and retry."; } else { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); } throw ex; } finally { } }
private void FillSettingsGridfromSession() { try { SettingsDataTable = new DataTable(); if (Session["Settings"] != null && Session["Settings"] != "") { SettingsDataTable = (DataTable)Session["Settings"];//VSWebBL.ConfiguratorBL.DominoPropertiesBL.Ins.GetAllData(); } if (SettingsDataTable.Rows.Count > 0) { SettingsGridView.DataSource = SettingsDataTable; SettingsGridView.DataBind(); } } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } finally { } }