Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Paul Wright (suedeapple) 277 posts 704 karma points
    Jul 05, 2012 @ 17:13
    Paul Wright (suedeapple)
    0

    Page Event Button In Members Sectio (editmember.aspx)

    Having trouble getting a custom button (page event) on a members profile.

    Looking at the umbraco source, it looks like the menu appears in the "m_MemberShipPanel" UmbracoPanel, but for the life of me I cant seem to get it working. 

    namespace MemberEvent
    {
        public class PageEvent : ApplicationBase  
        {

     
           public PageEvent(){
                umbraco.presentation.masterpages.umbracoPage.Load += new     MasterPageLoadHandler(umbracoPage_Load);
              }


            void umbracoPage_Load(object sender, EventArgs e)
            {

                
                umbracoPage up = (umbracoPage)sender;
                string path = up.Page.Request.Path.ToLower().Replace((umbraco.GlobalSettings.Path + "/").ToLower(), "");


              if (path.Contains("members/EditMember.aspx"))
             {
                    ContentPlaceHolder cph = (ContentPlaceHolder)up.FindControl("body");
                    PlaceHolder c2 = (PlaceHolder)cph.FindControl("plc");
                    UmbracoPanel mpl = (UmbracoPanel)c2.FindControl("m_MemberShipPanel");

                 
                    if (mpl != null)
                    {
                        string key = HttpContext.Current.Request.QueryString["id"];

                        ImageButton dependencies = mpl.Menu.NewImageButton();
                        dependencies.ImageUrl = umbraco.GlobalSettings.Path + "/images/editor/forecolor.gif";
                        dependencies.OnClientClick = "alert('Current member is : " + key + "'); return false;";
                    }
          }

               
            }
        }
    }

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Jul 06, 2012 @ 10:19
    Paul Wright (suedeapple)
    0

    Managed to get it working in the end :-)

    namespace MemberEvent
    {
        public class PageEvent : ApplicationBase  
        {

     
           public PageEvent(){
                umbraco.presentation.masterpages.umbracoPage.Load += new MasterPageLoadHandler(umbracoPage_Load);
              }


            void umbracoPage_Load(object sender, EventArgs e)
            {

                umbracoPage up = (umbracoPage)sender;
                string path = up.Page.Request.Path.ToLower().Replace((umbraco.GlobalSettings.Path + "/").ToLower(), "");


                if (path.Contains("editmember.aspx"))
             {
         
                    ContentPlaceHolder cph = (ContentPlaceHolder)up.FindControl("body");
                    Control c2 = cph.FindControl("TabView1");

                    if (c2 != null)
                    {

                        TabView panel = (TabView)c2;
          
                        string key = HttpContext.Current.Request.QueryString["id"];
                      
                        foreach (TabPage tp in panel.GetPanels())
                        {
                            tp.Menu.InsertSplitter();
                            ImageButton dependencies = tp.Menu.NewImageButton();
                            dependencies.ImageUrl = umbraco.GlobalSettings.Path + "/images/editor/masterpageContent.gif";
                            dependencies.OnClientClick = "alert('Current member ID is : " + key + "'); return false;";
                        }

                    }
          }

               
            }
        }
    }
     
Please Sign in or register to post replies

Write your reply to:

Draft