protected void Page_Load(object sender, EventArgs e) { int categoryID = -1; List <Channel> channels = null; BLClient client = null; string categoryName; if (Request.Params["categoryID"] == null) { Response.Redirect("~/Home.aspx"); } if (!int.TryParse(Request.Params["categoryID"], out categoryID)) { Response.Redirect("~/Home.aspx"); } if (!IsPostBack) { try { client = new BLClient(); channels = client.GetTop5MostPopular(categoryID); categoryName = client.GetCategoryName(categoryID); } finally { client.Dispose(); } CategoryName1.Text = categoryName; CategoryName2.Text = categoryName; Channels.DataSource = channels; Channels.DataBind(); } }