How to make the title for the viewselectormenu larger than the 20 character limit RRS feed

  • Question

  • Forgive me for re-hasing an old post, but I too have come across this problem and would like to make the title for the viewselectormenu larger than the 20 character limit but I am no developer and am not sure how to go about creating a control that is a subclass of the ViewSelectorMenu.

    Can anyone give me more detail on what code changes I need to make to the DefaultTemplates.ascx file that Bryan is suggesting.

    Many Thx in Advance.

    Moderator Note: The closed thread this post was Split off from (Split worked for once!) was this one:


    • Split by Mike Walsh FIN Tuesday, April 5, 2011 3:00 PM new question in 2010 closed thread
    • Edited by Mike Walsh FIN Tuesday, April 5, 2011 3:02 PM Moderator Note added
    Tuesday, April 5, 2011 12:50 PM


  • Hi Grant Coghlan,

    According to your description, I know you have problem in customizing a user control to replace the original one.

    First of all, I hope you could make sure one thing , it’s not recommend to do anything changes on the basis of sharepoint’s usercontrols. Because the updating of sharepoint might cover the original files.

    If you insist on changing it, here are detailed steps for your reference.

    1.       Using Visual Studio 2010, and create an empty sharepoint project named ‘SPUserControl’.

    2.       Right-click the project name and add new item, and select ‘User Control’ template named ‘MyViewSelectorMenu’

    3.       Double-click ‘MyViewSelectorMenu.ascx.cs’ and add sharepoint assembly like this:

    using Microsoft.SharePoint;

           override Text attribute as Bryan said.

           public override string Text




                    if (base.View == null)


                        return "";



                    return base.View.Title;



    4.  Build and deploy it.

    5.  Navigate to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES and Open DefaultTemplates.ascx file with VS.

    Add the following code to the head of page.

    <%@ Register TagPrefix ="wjc" TagName="us" src="~/_controltemplates/SPUserControl/MyViewSelectorMenu.ascx" %>

    Replace <%@ Register TagPrefix ="wjc" TagName="us" src="~/_controltemplates/SPUserControl/MyViewSelectorMenu.ascx" %> with the code snippet below

    <wjc:us MenuAlignment="Right" AlignToParent="true" runat="server" id="MyViewSelectorMenu" />

    6.       Ok, save and test it.



    Porter Wang

    • Marked as answer by KeFang Chen Thursday, April 14, 2011 2:13 AM
    Wednesday, April 6, 2011 12:43 PM