applying some different H menu types to mojo..

A place for discussion about skinning and design. Before posting questions here you should review the documentation about creating skins.

This thread is closed to new posts. You must sign in to post in the forums.
7/24/2010 6:54:53 AM
Gravatar
Total Posts 23

applying some different H menu types to mojo..

Hi all i am worderin how to do mega drop down menu in mojo portal..

i found a source but implementing to artisteer-24verticalmenu1 skin was very hard for me..

http://www.ramto.com/blog/post/Mega-Dropdown-Menu-with-ASPNET-and-jQuery-in-C.aspx

has some one suggest to do this ?

What i tryed ;

- copyed skin folder with different name
- selected new skin for portal to use
- added needed scripts to end of script.js
- copyed needed css files to the skin folder
- added skin css fie name to style.config
- changed web.config parameter to not cache css

what must be the other steps ?

 

thnks

KANPINAR

7/24/2010 9:26:13 AM
Gravatar
Total Posts 23

Re: applying some different H menu types to mojo..

Yes ...at the end of the day ... 

the next step is adding fallowing code in to the layout.master after art-nav...

 <%--- ----%>
                <asp:Literal ID="anchorLiteral" runat="server"></asp:Literal>
                <asp:Literal ID="menuLiteral" runat="server"></asp:Literal>
                <asp:Menu ID="Menu1" runat="server" StaticDisplayLevels="1" MaximumDynamicDisplayLevels="2"
                    DataSourceID="SiteMapDataSource1" Orientation="Horizontal" OnDataBound="Menu1_DataBound">
                </asp:Menu>
                <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" />
                <script language="c#" runat="Server"> 
               
                    protected void Menu1_DataBound(object sender, EventArgs e)
                    {
                        //hide the asp menu
                        Menu1.Visible = false;

                        //holds html anchors
                        anchorLiteral.Text = "";

                        //holds html mega dropdown menu
                        menuLiteral.Text = "";

                        //register megamenu script and create anchor foreach top level

                        StringBuilder mScript = new StringBuilder();
                        StringBuilder anchorText = new StringBuilder();
                        StringBuilder menuText = new StringBuilder();

                        mScript.AppendLine(@"<script type='text/javascript'>");
                        int cntLvl1 = 0;

                        foreach (MenuItem lvl1 in Menu1.Items)
                        {
                            cntLvl1++;
                            string anchorId = "megaanchor" + cntLvl1.ToString();
                            string megamenuId = "megamenu" + cntLvl1.ToString();

                            //anchor for each top level menu
                            anchorText.AppendLine("<a href='" + lvl1.NavigateUrl + "' id='" +
                                anchorId + "' class='topMenuCMSListMenuLinkHighlighted'>" +
                                lvl1.Text + "</a>");

                            //building mega menu div if menuitem has children
                            if (lvl1.ChildItems.Count > 0)
                            {
                                int cntLvl2 = 0;
                                //script for each top level menu
                                mScript.Append(@"jkmegamenu.definemenu('" + anchorId + "', '" +
                                    megamenuId + "', 'mouseover');");

                                menuText.AppendLine("<div id='" + megamenuId + "' class=megamenu>");

                                //building columns within the mega menu
                                foreach (MenuItem lvl2 in lvl1.ChildItems)
                                {
                                    cntLvl2++;
                                    menuText.AppendLine("<div class='column'>");
                                    menuText.AppendLine("<h3><a href='" + lvl2.NavigateUrl + "'>" +
                                        lvl2.Text + "</a></h3>");

                                    //create ul list if any children
                                    if (lvl2.ChildItems.Count > 0)
                                    {
                                        menuText.AppendLine("<ul>");
                                        foreach (MenuItem lvl3 in lvl2.ChildItems)
                                        {
                                            menuText.AppendLine("<li><a href='" + lvl3.NavigateUrl + "'>" +
                                                lvl3.Text + "</a></li>");
                                        }
                                        menuText.AppendLine("</ul>");
                                    }

                                    menuText.AppendLine("</div>");

                                    //break after 2 columns
                                    if (cntLvl2 >= 2)
                                    {
                                        menuText.AppendLine("<br style='clear: left' />");
                                        cntLvl2 = 0;
                                    }
                                }
                                menuText.AppendLine("</div>");
                            }
                        }

                        anchorText.AppendLine("</ul>");

                        anchorLiteral.Text = anchorText.ToString();
                        menuLiteral.Text = menuText.ToString();
                        mScript.AppendLine(" ");
                        mScript.Append(@"</");
                        mScript.Append("script>");
                        Guid gid = System.Guid.NewGuid(); Page.ClientScript.RegisterStartupScript(this.GetType(), gid.ToString(), mScript.ToString());
                    }
                </script>
                <%--- ----%>

 

somehow there is problem about links... i think i must check the code that appending menu content in Menu1_DataBound ...

7/24/2010 9:37:44 AM
Gravatar
Total Posts 23

Re: applying some different H menu types to mojo..

7/24/2010 9:53:51 AM
Gravatar
Total Posts 23

Re: applying some different H menu types to mojo..

after then changing the  navigate url in foreach makes the job for me..

 

....

menuText.AppendLine("<h3><a href='" + "/"+System.IO.Path.GetFileName(lvl2.NavigateUrl) + "'>" +
                                        lvl2.Text + "</a></h3>");

                                    //create ul list if any children
                                    if (lvl2.ChildItems.Count > 0)
                                    {
                                        menuText.AppendLine("<ul>");
                                        foreach (MenuItem lvl3 in lvl2.ChildItems)
                                        {
                                            menuText.AppendLine("<li><a href='" + "/"+System.IO.Path.GetFileName(lvl3.NavigateUrl) + "'>" +
                                                lvl3.Text + "</a></li>");
                                        }
                                        menuText.AppendLine("</ul>");
                                    }

...

 

WHAT next step is ?

can some one help me about cascading style "shit" ?

7/24/2010 9:59:32 AM
Gravatar
Total Posts 23

Re: applying some different H menu types to mojo..

7/25/2010 6:37:50 AM
Gravatar
Total Posts 18439

Re: applying some different H menu types to mojo..

Hi,

I recommend do not add your own page load even and do not add script runat=server in layout.master. layout.master already has a code behind compiled into mojoPortal.Web.dll and it already has a page load event. Adding your own could break existing functionality of layout.master.

If you want to make a menu you should encapsulate it in a control or UserControl, then you can use page load evet inside the UserControl and embed the UserControl into layout.master.

Best,

Joe

7/25/2010 10:03:29 AM
Gravatar
Total Posts 23

Re: applying some different H menu types to mojo..

hi,

thanks , i want to write in feature req. to add this kind of menu with some options.(and i am working on that implementation like your advise)

(http://www.aradigimbir.com/ i placed this kind of menu.. still working on styling. and practically its working..)

 

as soon as possible i want to do this as control with some options ( fow example comm. with forum names ext.)

 

best.

KANPINAR

7/27/2010 2:06:24 AM
Gravatar
Total Posts 23

Re: applying some different H menu types to mojo..

Hi ,

Joe i am trying to do but i could not decide where to start...

i will try to make a new sitemenu for ex. named mysitemenu control then use it but HOW ?

i simply added code to layout.master.cs and added same controls to that page but nothing showed in menu section.

help please...

 

thnks.

7/27/2010 5:37:17 AM
Gravatar
Total Posts 23

Re: applying some different H menu types to mojo..

i read tons of forum pages and still reading .. i think this subject is not good enoght right now.

 

good luck.

7/27/2010 6:27:54 AM
Gravatar
Total Posts 18439

Re: applying some different H menu types to mojo..

Hi,

You must be new to ASP.NET if you don't know how to register or implement a UserControl. Do a little searching and you will find many tutorials.

I  do have a document here that I made to teach designers how to register a UserControl in layout.master, but developers are expected to know ASP.NET basics such as this.

http://www.mojoportal.com/usercontrols-as-include-files.aspx

Hope it helps and good luck to you as well,

Joe

7/28/2010 5:06:35 AM
Gravatar
Total Posts 23

Re: applying some different H menu types to mojo..

Ok i read that but what about implementing in mojo menu SiteMenu and PageMenu ?

i was digging some sources  i think it's possible ?

 

7/29/2010 5:52:12 AM
Gravatar
Total Posts 18439

Re: applying some different H menu types to mojo..

Maybe sometime I will look into it. But the example code is not how I would implement it.

It might be ok for a custom solution, but  I would make a control adapter to change the rendering of the menu instead of looping through it after it already databound.

If you look in the source code under Web/Controls/Adapters you might get an idea of how I would implement it.

Don't hold your breath waiting for me to implement it though, there is a lot on my to do list.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.