/*Search for user activity */ protected void btnSearch_Click(object sender, EventArgs e) { if (Page.IsValid) { DataTable dt = new DataTable(); dt.Columns.Add("Date", typeof(DateTime)); dt.Columns.Add("Activity", typeof(String)); DateTime?from = tbDateFrom.Text != "" ? Convert.ToDateTime(tbDateFrom.Text + " 0:00:00.000") : (DateTime?)null; DateTime?to = tbDateTo.Text != "" ? Convert.ToDateTime(tbDateTo.Text + " 23:59:59.999") : (DateTime?)null; var model = new EDM.DataSource(); try { var query = model.sp_FilterHistory(userID, from, to); var result = query.Distinct().ToList(); if (result.Count > 0) { foreach (var row in result) { dt.LoadDataRow(new object[] { row.DateTime, row.AuditProcess }, false); } } //bind grid if (dt.Rows.Count > 0) { history = dt; } else { history = null; } bindHistory(); bindUsers(); //needed for modal performance } catch (System.Exception excec) { MISC.writetoAlertLog(excec.ToString()); ShowMessage("Something went wrong and the search could not be completed. Kindly try again and if the error persists, refer to the error log for details.", MessageType.Error); } } }