protected override void CreateChildControls()
        {
            if (!_error)
            {
                try
                {

                    base.CreateChildControls();
                    EnsurePanelFix();
                    // Your code here...
                    // this.Controls.Add(new LiteralControl(this.MyProperty));

                    pnlmylinks = new Panel();
                    pnlmylinks.ID = "pnlmylinks";
                    pnlmylinks.Attributes["class"] = "lyrpnlmylinks";
                    pnlmylinks.HorizontalAlign = System.Web.UI.WebControls.HorizontalAlign.Left;
                    gcbr = new HtmlGenericControl("br");
                    pnlmylinks.Controls.Add(gcbr);

                    lblmylinksheader = new Label();
                    lblmylinksheader.ID = "lblmylinksheader";
                    lblmylinksheader.Text = "<center>Manage My Quick Links</center>";
                    lblmylinksheader.Font.Size = new FontUnit("14px");
                    lblmylinksheader.Font.Bold = true;
                    pnlmylinks.Controls.Add(lblmylinksheader);
                    gcbr = new HtmlGenericControl("br");
                    pnlmylinks.Controls.Add(gcbr);

                    HtmlGenericControl  gc = new HtmlGenericControl("span");
                    gc.InnerText = "Title";
                    pnlmylinks.Controls.Add(gc);

                    gcbr = new HtmlGenericControl("br");
                    pnlmylinks.Controls.Add(gcbr);

                    txttitle = new TextBox();
                    txttitle.ID = "txttitle";
                    pnlmylinks.Controls.Add(txttitle);

                    gcbr = new HtmlGenericControl("br");
                    pnlmylinks.Controls.Add(gcbr);

                    gc = new HtmlGenericControl("span");
                    gc.InnerText = "Url";
                    pnlmylinks.Controls.Add(gc);

                    gcbr = new HtmlGenericControl("br");
                    pnlmylinks.Controls.Add(gcbr);

                    txturl = new TextBox();
                    txturl.ID = "txturl";
                    pnlmylinks.Controls.Add(txturl);

                    gcbr = new HtmlGenericControl("br");
                    pnlmylinks.Controls.Add(gcbr);
                    btnmylinksok = new Button();
                    btnmylinksok.ID = "btnmylinksok";
                    btnmylinksok.Text = "Ok";
                    pnlmylinks.Controls.Add(btnmylinksok);

                    btnmylinksok.Click += new EventHandler(btnmylinksok_Click);

                    btnmylinkscancel = new Button();
                    btnmylinkscancel.ID = "btnmylinkscancel";
                    btnmylinkscancel.Text = "Cancel";

                    btnmylinkscancel.Click += new EventHandler(btnmylinkscancel_Click);
                    pnlmylinks.Controls.Add(btnmylinkscancel);
                    pnlmylinks.Visible = false;

                    gcbr = new HtmlGenericControl("br");
                    pnlmylinks.Controls.Add(gcbr);

                    lstmyquicklinks = new ListBox();
                    lstmyquicklinks.ID = "lstmyquicklinks";
                    lstmyquicklinks.Width = new Unit("250px");
                    lstmyquicklinks.Rows = 10;
                    lstmyquicklinks.SelectionMode = ListSelectionMode.Multiple;

                    ServerContext _serviceContext = ServerContext.Current;
                    UserProfileManager profilmanager = new UserProfileManager(_serviceContext);

                    UserProfile _userProfile = profilmanager.GetUserProfile(true);

                    if (_userProfile.PersonalSite != null)
                    {

                        QuickLinkManager qlmanager = new QuickLinkManager(_userProfile);
                        QuickLink[] ql = qlmanager.GetItems();

                        if (ql.Length != 0)
                        {
                            foreach (QuickLink objql in ql)
                            {
                                ListItem litem = new ListItem();
                                litem.Text = objql.Title;
                                lstmyquicklinks.Items.Add(litem);
                            }
                        }
                    }

                    pnlmylinks.Controls.Add(lstmyquicklinks);
                    gcbr = new HtmlGenericControl("br");
                    pnlmylinks.Controls.Add(gcbr);
                    btndeletemylinks = new Button();
                    btndeletemylinks.ID = "btndeletemylinks";
                    btndeletemylinks.Text = "Delete";
                    btndeletemylinks.Click += new EventHandler(btndeletemylinks_Click);
                    pnlmylinks.Controls.Add(btndeletemylinks);

                    //this.Controls.Add(pnlmylinks);

                    astrigger = new AsyncPostBackTrigger();
                    astrigger.ControlID = btnmylinksok.ID;
                    astrigger.EventName = "Click";
                    upanel2.Triggers.Add(astrigger);

                    astrigger = new AsyncPostBackTrigger();
                    astrigger.ControlID = btnmylinkscancel.ID;
                    astrigger.EventName = "Click";
                    upanel2.Triggers.Add(astrigger);

                    astrigger = new AsyncPostBackTrigger();
                    astrigger.ControlID = btndeletemylinks.ID;
                    astrigger.EventName = "Click";
                    upanel2.Triggers.Add(astrigger);
                    upanel2.ContentTemplateContainer.Controls.Add(pnlmylinks);

                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }

                //IsDisplayed
            }
        }
        public void GenerateMyQuickLinks()
        {
            ServerContext _serviceContext = ServerContext.Current;
            UserProfileManager profilmanager = new UserProfileManager(_serviceContext);

            UserProfile _userProfile = profilmanager.GetUserProfile(true);

            if (_userProfile.PersonalSite != null)
            {

                QuickLinkManager qlmanager = new QuickLinkManager(_userProfile);
                QuickLink[] ql = qlmanager.GetItems();

                if (ql.Length != 0)
                {
                    HtmlGenericControl ul = new HtmlGenericControl("ul");
                    ul.Attributes["class"] = "rightsideul";
                    foreach (QuickLink objql in ql)
                    {
                        HtmlGenericControl li = new HtmlGenericControl("li");
                        li.Attributes["class"] = "rightsideli";

                        HtmlGenericControl a = new HtmlGenericControl("a");
                        a.Attributes["href"] = objql.Url;
                        a.InnerText = objql.Title;
                        li.Controls.Add(a);
                        ul.Controls.Add(li);
                    }

                    //this.Controls.Add(ul);
                    upanel2.ContentTemplateContainer.Controls.Add(ul);
                }
            }
        }
        protected void btndeletemylinks_Click(object sender, EventArgs e)
        {
            pnlmylinks = this.FindControl("pnlmylinks") as Panel;
            lstmyquicklinks = this.FindControl("lstmyquicklinks") as ListBox;

            if (pnlmylinks != null && lstmyquicklinks != null)
            {
                try
                {

                    foreach (ListItem item in lstmyquicklinks.Items)
                    {
                        if (item.Selected)
                        {
                            ServerContext _serviceContext = ServerContext.Current;
                            UserProfileManager profilmanager = new UserProfileManager(_serviceContext);

                            UserProfile _userProfile = profilmanager.GetUserProfile(true);

                            if (_userProfile.PersonalSite != null)
                            {

                                QuickLinkManager qlmanager = new QuickLinkManager(_userProfile);
                                QuickLink[] ql = qlmanager.GetItems();

                                if (ql.Length != 0)
                                {
                                    foreach (QuickLink objql in ql)
                                    {

                                        if (objql.Title == item.Text)
                                        {
                                            objql.Delete();
                                        }
                                    }
                                }
                            }
                        }
                    }
                    GenerateMyQuickLinks();
                    pnlmylinks.Visible = false;

                }
                catch (Exception exc)
                {

                }
            }
        }