using System;
using System.Data;
using System.ComponentModel;
using Telerik.Reporting.Examples.CSharp;

public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            DataTable gridData = new DataTable();
            gridData.Columns.Add("Report");
            gridData.Columns.Add("Description");            
            gridData.Columns.Add("NavigateUrl");
            
            foreach (Type t in ReportExplorer.GetReports())
            {
                DescriptionAttribute description = 
                    TypeDescriptor.GetAttributes(t)[typeof(DescriptionAttribute)] as DescriptionAttribute;

                object[] values = new object[]
                {
                    t.Name
                    , (null != description ? description.Description : "-")
                    , "ReportViewer.aspx?ReportName=" + Server.UrlEncode(t.AssemblyQualifiedName)                        
				};

                gridData.Rows.Add(values);                
            }
            
            this.GridView1.DataSource = gridData;
            this.GridView1.DataBind();
        }
    }
}
