public void DoBasicSearch() { try { DataSet incidentData = new DataSet(); incidentData = sqlqueryBasic(); GridView1.AutoGenerateColumns = true; GridView1.DataSource = incidentData; IncidentTable = incidentData.Tables[0]; //check incomming data in table format GridView1.DataSource = IncidentTable; GridView1.DataBind(); GridView1.UseAccessibleHeader = true; GridView1.HeaderRow.TableSection = TableRowSection.TableHeader; lblResults.Visible = true; lblResults.ForeColor = Color.Green; lblResults.Text = "Your search has returned " + incidentData.Tables[0].Select("'Incident Number' IS NOT NULL").Length.ToString() + " records."; AdvResults.Update(); } catch (Exception exec) { Console.WriteLine(exec); } }
public void BindResultsToGrid() { IncidentData = QueryBuilder(); try { //Bind dataset to the gridview AdvSearchResults.AutoGenerateColumns = false; IncidentTable = IncidentData.Tables[0]; AdvSearchResults.DataSource = IncidentTable; //can be changed to a dataset incidentTable might be used for sorting later AdvSearchResults.DataBind(); AdvSearchResults.UseAccessibleHeader = true; AdvSearchResults.HeaderRow.TableSection = TableRowSection.TableHeader; lblResults.Visible = true; lblResults.ForeColor = Color.Green; lblResults.Text = "Your search has returned " + IncidentData.Tables[0].Select("'Incident Number' IS NOT NULL").Length + " records."; AdvResults.Update(); } catch (Exception err) { lblResults.Visible = true; lblResults.ForeColor = Color.Red; lblResults.Text = "An error has occurred loading data into the table view. "; lblResults.Text += err.Message; Console.WriteLine(err.ToString()); } }
protected void DD_area_SelectedIndexChanged(object sender, EventArgs e) { AdvResults.Update(); }