SharePoint Developer Center > SharePoint Products and Technologies Forums > SharePoint - Design and Customization > code blocks in default.master - Value does not fall within the expected range
Ask a questionAsk a question
 

Questioncode blocks in default.master - Value does not fall within the expected range

  • Wednesday, November 04, 2009 9:50 PMJCNET Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code

    Can i have code blocks in a default.master ?

    <HEAD runat="server">
    .. other stuff that was already here.	
    	
    <script runat="server">	
    protected override void OnLoad(EventArgs e)
    {
    SPContent.Current.Web.AllowUnsafeUpdates = true;
    }
    </script>
    	
    </HEAD>







    results in this error.

    Value does not fall within the expected range

    My goal is to programatically rename the home tab in the top link Bar.

    Thanks for any help or information.

All Replies

  • Wednesday, November 04, 2009 10:50 PMAndré Lage Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    On you web.config add  on the tag "configuration/SharePoint/PageParserPaths"
    <PageParserPaths>
      <PageParserPath VirtualPath="/pages/test.aspx" CompilationMode="Always" AllowServerSideScript="true" />
    </PageParserPaths>
    To allow code Behind on you aspx page. 

    Here a article
    http://blogs.msdn.com/kaevans/archive/2007/04/26/code-blocks-are-not-allowed-in-this-file-using-server-side-code-with-sharepoint.aspx
    André Lage Microsoft SharePoint, CRM and Sybase Consultant
    Blog:http://aaclage.blogspot.com
    Codeplex:http://spupload.codeplex.com/http://simplecamlsearch.codeplex.com/
  • Thursday, November 05, 2009 5:59 AMconverscient Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    i believe JCNET had already done it, otherwise he would have gotten "Code blocks are not allowed in this file" error msg. Can you show more of the error log/exception?

    You can probably use some javascript to rename the the home tab as well.

    <span id="ctl00_PlaceHolderGlobalNavigation_PlaceHolderGlobalNavigationSiteMap_GlobalNavigationSiteMap"><span><a class="ms-sitemapdirectional" href="/">YOUR SITE NAME HERE</a>


    Never stop learning.
  • Thursday, November 05, 2009 3:56 PMJCNET Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Thank you. Yes, sorry, my web.config is already set to allow codeblocks with the <PageParserPath>.

    Converscient, won't that also change the name of my Site as well in my Header?

    I'm actually trying to set the Tab name back to "HOME" as I had to enable publishing so I could secure some other Tabs on the top. And as a result of that (for not sure what reason), MOSS changes my HOME tab to the name of the Site.

    Thanks again!

  • Monday, November 09, 2009 10:23 AMconverscient Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Sorry i didnt understand your post fully, i have a very simple OOTB (out of the box) solution for you... hide the Home tab of the site by going "Site Actions" -> Modify Navigation and remove Home and add a new link with the URL pointing to your "Home" site and you can have ability to name it

    or you can go to root site and go "Site Actions" -> Site settings -> Title, Description and Icon and rename your home site..

    Never stop learning.
  • Wednesday, November 11, 2009 9:20 PMJCNET Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Navigation does not offer the Home tab for editing when publishing is applied and you get the Richer Navigation feature.

    I'd have to rename the site to HOME and the results in other problems.
  • Wednesday, November 11, 2009 10:12 PMCathy Dew Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    JCNET,

    The most simple solution is to hide the current Site Name tab and create a link heading that is Home.  Then link this Home heading tab to the homepage/welcome page for your site. This is what converscient suggested and I agree it is the easiest option.

    I am not sure what changes you would need to make to get the code blocking working to change just the heading in one of the top navigation tabs.




  • Tuesday, November 17, 2009 8:51 PMJCNET Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    How/where do I hide the current home tab? in the custom master page? With what? CSS? Got an example?

    If so, won't this mean that if user select view all or some other _layouts page, that they will continue to see the current home tab, in addition tot he new home tab?

    I found a thread on a coded solution, but I could not get it to work.

    Thank you.