private void filldropdown_ReadLogsComboBoxfromsession() { DataTable dt = new DataTable(); if (Session["LogFiles"] != "" && Session["LogFiles"] != null) { dt = Session["LogFiles"] as DataTable; ReadLogsComboBox.TextField = "Path"; ReadLogsComboBox.ValueField = "FullPath"; ReadLogsComboBox.DataBind(); } }
protected void filldropdown_ReadLogsComboBox() { DataTable dt = new DataTable(); dt = getLogFilesDataTable(); for (int i = dt.Rows.Count - 1; i >= 0; i--) { DataRow dr = dt.Rows[i]; string newrow = dt.Rows[i]["Path"].ToString(); if (!newrow.EndsWith(".txt")) { dr.Delete(); } } ReadLogsComboBox.DataSource = dt; Session["LogFiles"] = dt; ReadLogsComboBox.TextField = "Path"; ReadLogsComboBox.ValueField = "FullPath"; ReadLogsComboBox.DataBind(); }