コード例 #1
0
 protected void OnPaging(object sender, GridViewPageEventArgs e)
 {
     AdvSearchResults.PageIndex = e.NewPageIndex;
     AdvSearchResults.DataBind();
     AdvSearchResults.UseAccessibleHeader    = true;
     AdvSearchResults.HeaderRow.TableSection = TableRowSection.TableHeader;
 }
コード例 #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Clear();
        Response.Buffer  = true;
        Response.Charset = "";
        var    time = DateTime.Now;
        string date = time.ToString(CultureInfo.InvariantCulture);

        Response.AddHeader("content-disposition", "attachment;filename=" + date + "_IRS_Advanced_Tool_Export" + ".xls");
        Response.ContentType = "application/vnd.ms-excel";

        AdvSearchResults.Columns[7].Visible  = true;
        AdvSearchResults.Columns[8].Visible  = true;
        AdvSearchResults.Columns[9].Visible  = true;
        AdvSearchResults.Columns[10].Visible = true;


        AdvSearchResults.AllowPaging = false;
        AdvSearchResults.DataBind();

        StringWriter   stringWrite = new StringWriter();
        HtmlTextWriter htmlWrite   = new HtmlTextWriter(stringWrite);

        AdvSearchResults.RenderControl(htmlWrite);
        Response.Write(stringWrite.ToString());

        AdvSearchResults.Columns[7].Visible  = false;
        AdvSearchResults.Columns[8].Visible  = false;
        AdvSearchResults.Columns[9].Visible  = false;
        AdvSearchResults.Columns[10].Visible = false;


        Response.End();
    }
コード例 #3
0
    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());
        }
    }