コード例 #1
0
        /// <summary>Handles the Load event of the Page control.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            GridView.DataSource = null;
            using (JobsService.JobsClient jobsService = new JobsService.JobsClient())
            {
                JobsService.Job[] jobs = jobsService.GetMany(Convert.ToInt32(NumRowsTextBox.Text));

                table = new DataTable();
                table.Columns.Add("Name", typeof(string));
                table.Columns.Add("Status", typeof(string));
                table.Columns.Add("XML", typeof(string));
                table.Columns.Add("URL", typeof(string));

                // Loop through all jobs
                foreach (JobsService.Job job in jobs)
                {
                    if (ShowAllCheckBox.Checked || job.Status != JobsService.StatusEnum.Completed)
                    {
                        DataRow newRow = table.NewRow();
                        table.Rows.Add(newRow);

                        newRow["Name"] = job.Name;
                        newRow["Status"] = job.Status.ToString();
                        newRow["XML"] = "XML";
                        newRow["URL"] = job.URL;
                    }
                }
            }

            GridView.DataSource = table;
            GridView.DataBind();
        }