protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["authenticated"] == null)
          Response.Redirect("Login.aspx");
        if (IsPostBack)
          return;
        ServiceInterface server = new ServiceInterface();
        if (Request.QueryString["idSchedule"] != null)
        {
          lHeading.Text = "Edit Schedule";
          WebSchedule sched = server.GetSchedule(Int32.Parse(Request.QueryString["idSchedule"]));
          lChannel.Text = sched.channelName;
          hfIdChannel.Value = sched.idChannel.ToString();
          edStart.Text = sched.startTime.ToString();
          edEnd.Text = sched.endTime.ToString();
          edTitle.Text = sched.programName;
          cbScheduleType.SelectedValue = sched.scheduleType.ToString();
        }
        else if (Request.QueryString["idProgram"] != null)
        {
          WebProgram p = server.GetEPG(Int32.Parse(Request.QueryString["idProgram"]));

          WebChannel c = server.GetChannel(p.idChannel);
          cbChannelType.SelectedIndex = c.isTv ? 1 : 2;
          populateChannelGroups();
          cbChannel.SelectedValue = p.idChannel.ToString();
          lChannel.Text = p.channelName;
          hfIdChannel.Value = p.idChannel.ToString();

          edStart.Text = p.startTime.ToString();
          edEnd.Text = p.endTime.ToString();
          edTitle.Text = p.Title;
        }
    }