Missing DropDown menu for choosing of views

Posted: August 3, 2010 in Sharepoint, Sharepoint 2010

When add another web part to standard view page causes missing of drop down menu for choosing view.

Resolution:

Open view page in SharePoint Designer in advanced mode.

Find row …

<SharePoint:ListTitleViewSelectorMenu AlignToParent="true" id="LTViewSelectorMenu" runat="server" />

and replace with…

<SPAN id=onetidPageTitleSeparator><SPAN><SPAN style="POSITION: relative; WIDTH: 11px; DISPLAY: inline-block; HEIGHT: 11px; OVERFLOW: hidden"><IMG style="POSITION: absolute; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; TOP: -585px !important; LEFT: 0px !important" alt=: src="/_layouts/images/fgimg.png"></SPAN></SPAN></SPAN>
<SharePoint:ViewSelectorMenu ID="viewSelectorMenu1" runat="server" />
Comments
  1. Mar says:

    thanks…I am trying to figure out the problem and I found your blog!

  2. avishnyakov says:

    Well, we’ve develop custom aspx page for views in list definition and we’ve found the same issue. You can fix it with follow code on your aspx page or add your web-part on exist page and find LTViewSelectorMenu on it.

    typeof(ListTitleViewSelectorMenu)
    .GetField(“m_wpSingleInit”, BindingFlags.Instance | BindingFlags.NonPublic)
    .SetValue(LTViewSelectorMenu, true);

    typeof(ListTitleViewSelectorMenu)
    .GetField(“m_wpSingle”, BindingFlags.Instance | BindingFlags.NonPublic)
    .SetValue(LTViewSelectorMenu, true);

  3. pavan says:

    Hi

    I would like to add the view list like default,public and so on in the web part header so that i can select the view from drop down as it is in sharepoint 2007, i would appreciate if some one can help me to achieve the task. A detailed explanation is expected as am a new to sharepoint 2010.

  4. […] Links you may find useful Some links on Missing Dropdown in SharePoint 2010 List Tools Tab […]

  5. Hi! Someone in my Myspace group shared this website with us so I came to check it out.
    I’m definitely loving the information. I’m book-marking and will be tweeting this to my followers!
    Excellent blog and great style and design.

  6. wholesale says:

    An intriguing discussion is worth comment.

    There’s no doubt that that you should write more on this subject matter, it might not be a taboo matter but typically folks don’t
    speak about such topics. To the next! Cheers!!

  7. My brother suggested I may like this website. He used to be entirely right.

    This publish truly made my day. You can not consider just how so much time I had spent for this information!
    Thanks!

  8. Jack says:

    I commented out the line to be replaced and added the code as follows:
    <!– –>

    On the line that begins with “IMG style and ends with “fgimg.png”, that line appears in yellow in sharepoint designer and when hovering over the line, the following message appears.

    Empty elements must have an end tag, or the start tag must end with />

    Did I miss something ?

  9. website says:

    Have you ever thought about publishing an e-book or guest authoring on
    other sites? I have a blog based upon on the same ideas you discuss and would really like
    to have you share some stories/information.
    I know my readers would enjoy your work. If you’re even remotely interested, feel free to send me an email.

  10. An interesting discussion is worth comment. I do believe that
    you should write more about this subject matter, it might not be a taboo subject but typically people do not speak about such subjects.
    To the next! Kind regards!!

  11. zquiet says:

    If you would like to improve your experience simply keep visiting this web site and be updated with the newest
    news posted here.

  12. Ona says:

    Unquestionably consider that which you said. Your favorite
    justification appeared to be at the internet the simplest thing to take note of.

    I say to you, I certainly get annoyed while folks think about worries that they plainly do not know about.

    You managed to hit the nail upon the top and also defined out
    the entire thing without having side effect , other people can take a signal.
    Will probably be back to get more. Thanks

  13. I really like it whenever people get together and share views.
    Great blog, stick with it!

  14. I think that is among the so much vital info for me.
    And i am satisfied studying your article. But wanna observation
    on few general things, The site style is great, the articles is in reality nice :
    D. Good activity, cheers

  15. Romeo says:

    If you desire to grow your knowledge just
    keep visiting this website and be updated with the latest information posted here.

  16. […] there I found a post describing how you can use SharePoint Designer to modify a view’s .aspx page to put the view selec…. The problem with this method though is that you have to edit each view page individually and that […]

  17. […] there I found a post describing how you can use SharePoint Designer to modify a view’s .aspx page to put the view selec…. The problem with this method though is that you have to edit each view page individually and that […]

  18. Mavis says:

    Thank you!! Good Post!

  19. Bill Jones says:

    My page with this issue was already matching the site definition. After looking at sites that were not displaying this behavior, I found that the system masterpage was set to a different masterpage than the site masterpage.

    After I changed the system masterpage to match the site masterpage, the view dropdown started working as expected.

    This will only work on sites with publishing enabled.The site in question:
    A: Has a customized masterpages
    B: Was in-place upgrade from 2007

  20. Petey says:

    Hi,
    The code above appears to work, but when I click refresh. It shows the (current view name) + (down arrow) . Button when I click refresh the (current view name) disappers, only leaving the (down arrow). Is there anyway to keep the existing view name in place?

    Please help.

  21. […] there I found a post describing how you can use SharePoint Designer to modify a view’s .aspx page to put the view selec…. The problem with this method though is that you have to edit each view page individually and that […]

  22. Jeb Castelo says:

    There is an easier way… You can use javascript to render the list view selector. Pate the below script into a content editor webpart or link a text file to the content editor web part.

    var menuMouseover = “Change View”;

    ExecuteOrDelayUntilScriptLoaded(buildCustomViewMenu,’sp.js’);

    var customViewCollection = null;
    function buildCustomViewMenu() {
    var clientContext, web, listCollection,list;
    clientContext = new SP.ClientContext.get_current();
    if(clientContext != undefined && clientContext != null) {
    web = clientContext.get_web();
    listCollection = web.get_lists();
    list = listCollection.getById(_spPageContextInfo.pageListId);
    this.customViewCollection = list.get_views();
    clientContext.load(this.customViewCollection);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.buildCustomViewMenuSucceeded), Function.createDelegate(this, this.buildCustomViewMenuFailed));
    }
    }

    function buildCustomViewMenuSucceeded() {
    var viewInfo, currViewObj, viewEnumerator, view;
    viewInfo = [];
    currViewObj = {};
    viewEnumerator = this.customViewCollection.getEnumerator();
    while (viewEnumerator.moveNext()) {
    view = viewEnumerator.get_current();
    viewInfo.push({title:view.get_title(),guid:view.get_id(),relUrl:view.get_serverRelativeUrl()});
    }
    for(var key in viewInfo){
    if(unescape(location.pathname).match(viewInfo[key].relUrl)!==null){
    currViewObj = viewInfo[key];
    }
    }
    buildMenu(currViewObj);
    }

    function buildCustomViewMenuFailed(sender, args) {
    alert(‘[buildCustomViewMenu]\n\n’ + args.get_message());
    }

    function buildMenu(currViewObj){
    var b = [];
    b.push(“”);
    b.push(“”);
    b.push(“”);
    b.push(““);
    b.push(“”+currViewObj.title+””);
    b.push(“”);
    b.push(“
    “);
    b.push(“”);
    b.push(“”);
    b.push(“”);
    b.push(“”);
    b.push(“”);
    b.push(“”);
    b.push(“”);
    document.getElementById(‘ctl00_PlaceHolderPageTitleInTitleArea_ctl01_ctl00’).innerHTML += b.join(”);
    }

    • Jeb Castelo says:

      var menuMouseover = “Change View”;

      ExecuteOrDelayUntilScriptLoaded(buildCustomViewMenu,’sp.js’);

      var customViewCollection = null;
      function buildCustomViewMenu() {
      var clientContext, web, listCollection,list;
      clientContext = new SP.ClientContext.get_current();
      if(clientContext != undefined && clientContext != null) {
      web = clientContext.get_web();
      listCollection = web.get_lists();
      list = listCollection.getById(_spPageContextInfo.pageListId);
      this.customViewCollection = list.get_views();
      clientContext.load(this.customViewCollection);
      clientContext.executeQueryAsync(Function.createDelegate(this, this.buildCustomViewMenuSucceeded), Function.createDelegate(this, this.buildCustomViewMenuFailed));
      }
      }

      function buildCustomViewMenuSucceeded() {
      var viewInfo, currViewObj, viewEnumerator, view;
      viewInfo = [];
      currViewObj = {};
      viewEnumerator = this.customViewCollection.getEnumerator();
      while (viewEnumerator.moveNext()) {
      view = viewEnumerator.get_current();
      viewInfo.push({title:view.get_title(),guid:view.get_id(),relUrl:view.get_serverRelativeUrl()});
      }
      for(var key in viewInfo){
      if(unescape(location.pathname).match(viewInfo[key].relUrl)!==null){
      currViewObj = viewInfo[key];
      }
      }
      buildMenu(currViewObj);
      }

      function buildCustomViewMenuFailed(sender, args) {
      alert(‘[buildCustomViewMenu]\n\n’ + args.get_message());
      }

      function buildMenu(currViewObj){
      var b = [];
      b.push(“”);
      b.push(“”);
      b.push(“”);
      b.push(““);
      b.push(“”+currViewObj.title+””);
      b.push(“”);
      b.push(“
      “);
      b.push(“”);
      b.push(“”);
      b.push(“”);
      b.push(“”);
      b.push(“”);
      b.push(“”);
      b.push(“”);
      document.getElementById(‘ctl00_PlaceHolderPageTitleInTitleArea_ctl01_ctl00’).innerHTML += b.join(”);
      }

Leave a reply to wholesale Cancel reply