protected override void OnLoad(EventArgs e)
 {
     if (!IsPostBack)
     {
         using (PublishableLocations ObjLocations = new PublishableLocations())
         {
             ddlPublishableLocations.Items.Clear();
             SPListItemCollection items = ObjLocations.GetPublishableLocations();
             foreach (SPListItem item in items)
             {
                 ddlPublishableLocations.Items.Add(new ListItem(item.Title, item["Persistent ID"].ToString()));
             }
             if (Request.QueryString["rf"] != null)
             {
                 _rootFolder=Request.QueryString["rf"].ToString();
                 ddlRoot.SelectedValue = _rootFolder;
                 if (_rootFolder == "2")
                 {
                     ddlPublishableLocations.Visible = true;
                     if (Request.QueryString["pid"] != null)
                     {
                         ddlPublishableLocations.SelectedValue = Request.QueryString["pid"].ToString();
                     }
                 }
                 else
                 {
                     ddlPublishableLocations.Visible = false;
                 }
             }
         }
     }
 }
        protected override void OnLoad(EventArgs e)
        {
            if (Request.QueryString["SourceURL"] != null)
            {
                _sourceUrl = Request.QueryString["SourceURL"].ToString();
            }
            if (Request.QueryString["ID"] != null)
            {
                _itemId = Request.QueryString["ID"].ToString();
            }
            if (Request.QueryString["List"] != null)
            {
                _listId = Request.QueryString["List"].ToString();
            }
            if (!IsPostBack)
            {
                SPWeb ObjWeb = SPContext.Current.Web;
            //                btnYes.PostBackUrl = ObjWeb.Site.Url + "/_layouts/CLIFPages/ClifSendFedora.aspx?ListId=" + _listId + "&ItemId=" + _itemId;
                SPList ObjList = ObjWeb.Lists[new Guid(_listId)];
                SPListItem item = ObjList.Items.GetItemById(Convert.ToInt32(_itemId));

                if (item.Workflows.Count == 0 )
                {
                    AttacheWorkflow(ObjWeb);
                    lblMessage.Visible = false;
                    btnYes.Enabled = true;
                }
                else
                {
                    if (item.Workflows[item.Workflows.Count-1].InternalState==SPWorkflowState.Running)
                    {
                        lblMessage.Visible = true;
                        lblMessage.Text = "Document approval request for publication already submitted.";
                        btnYes.Enabled = false;
                    }
                }

                lblTitle.Text = item.Title;
                lblContentSubject.Text = item["Content Subject"].ToString();
                if (item["Content MimeType"] != null)
                {
                    lblContentMimeType.Text = item["Content MimeType"].ToString();
                }
                if (item["Persistent ID"] != null)
                {
                    lblPersistentID.Text = item["Persistent ID"].ToString();
                }
                else
                {
                    lblPersistentID.Text = "(auto-generated)";
                }

                //Populates all publication locations
                using (PublishableLocations ObjLocations = new PublishableLocations())
                {
                    SPListItemCollection _locations = ObjLocations.GetPublishableLocations();
                    int i = 0;
                    foreach (SPListItem _location in _locations)
                    {
                        i++;
                        ddlPublishTo.Items.Add(new ListItem(_location.Title, _location.ID.ToString()));
                    }
                }
            }
            base.OnLoad(e);
        }