Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Class inititation creates a list called PostResults filled with Posts
                DataSources ds = new DataSources();

                //Loop post results from all data sources
                foreach (var post in ds.PostResults)
                {
                    Int32 Rcount = Convert.ToInt32(issueTable.Rows.Count);

                    //Make sure we create columns if needed
                    if (Rcount == 0)
                    {
                        issueTable.Columns.Add("Track");
                        issueTable.Columns.Add("Name");
                        issueTable.Columns.Add("Text");
                        issueTable.Columns.Add("Category");
                        issueTable.Columns.Add("Source");
                        issueTable.Columns.Add("GUID");
                        issueTable.Rows.Add("Track", post.Name, post.PostText, post.Category, post.Source, post.GUID);
                        set.Tables.Add(issueTable);
                    }
                    else
                    {
                        if (post.Name != "")
                        {
                            DataRow dr = issueTable.NewRow();
                            dr["Track"]    = "Track";
                            dr["Name"]     = post.Name;
                            dr["Text"]     = post.PostText;
                            dr["Category"] = post.Category;
                            dr["Source"]   = post.Source;
                            dr["GUID"]     = post.GUID;
                            issueTable.Rows.Add(dr);
                        }
                    }
                }

                //Bind data to table
                Issues.DataSource = set;
                Issues.DataBind();
            }
        }