Wednesday, April 4, 2012

Error on SharePoint list: Invalid number value...


Got the following error while working on a list with BDC data columns:
Invalid number value.  A number field contains invalid data. Please check the value and try again.
Cause: On the database where the BDC is pulling data from, one of the columns was changed from type of Int32 to a String.  Even though the xml definition file was updated accordingly, this error comes when you try to save the list item after picking a BDC item.

Resolution:  Go to the list settings, click on the BDC column, uncheck the 'problem' column (i.e. the column that changed type), go back and the problem is gone.  You can re-add the column back by checking it.  Refresh.  All the data will be refreshed and no more errors.

Monday, March 19, 2012

Expand the multiselect box in SharePoint

To make the multselect boxes larger, put the following code in a 'content editor web part' and set it to hidden.  Adjust to your own needs.


//**********************************************************************
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
            $(document).ready(function() {                
                        $('.ms-long select').parent('div').css('width', '320');
                        $('.ms-long select').css('font-size', 'xx-small');
                        $('.ms-long select').css('width', '100%');
            });        
</script>
//**********************************************************************


Wednesday, December 14, 2011

Toggle Ribbon with JQuery

To toggle 2010's ribbon neat and short:

Reference JQuery:
<script src="/sites/inet/_js/jquery-1.4.4.min.js" type="text/ecmascript"></script>
Put this either in a separate .js and reference the js file:
$(document).ready(function(){
    $('#s4-ribbonrow').hide();
    $('#toggleribbon').click(function() {
         $('#s4-ribbonrow').toggle();
    });
 });

Put this some where.  This is what you will click to toggle the ribbon:
<img id="toggleribbon" src="/../../images/imgToggle.jpg"/>

Wednesday, November 23, 2011

Custom form did not stick to list

A site owner customized a new form for a list.  He then went into SharePoint Designer and went to list properties to set the form as the 'new item form'.  When he clicked OK, the setting did not seem to be saved and reverted back to the original newform.aspx. 

Solution: Under 'List Properties' -> 'Supporting Files' (4th tab),  make sure the second drop down 'Content type specific forms' is set to 'item', then go and select the new customized form:

Wednesday, November 16, 2011

Cannot connect to sql express 2008, server doesn't support requested protocol

Got the following error:


Need to enable TCP/IP on Sql Server Configuration Manager:


Once TCP/IP is enabled, restart the SQL Instance:


Now connecting from VS 2010 works. 

Monday, November 14, 2011

Hide left nav

Hiding the left nav:

<script type="text/javascript"> 
 $(document).ready(function(){
    $("#s4-leftpanel").addClass("hide");
    $("#MSO_ContentTable").css("margin-left", "-10px");  //adjust for the margin
 });
</script>

The css:
.hide{
 display:none;
}

Wednesday, November 2, 2011

Add Left Nav to new page

1. Open the page in SharePoint Designer 2010.

2. Go to the 'style' tab in the ribbon, on the 'master page' section, click on 'Attach' and attach the custom (or default) master page:

3. Afterwards, you should see something like this:


  The place holder for left nav:


4.  Select the PlaceHolderleftNavBar, click on the arrow and select 'Default to Master's content'.  The page should now show the left nav:

Tuesday, October 18, 2011

SharePoint 2010 branding: webpart

A really nice article on rounding corners for the webpart:
https://www.nothingbutsharepoint.com/sites/eusp/Pages/web-part-style-in-sharepoint-2010.aspx

SharePoint 2010 branding: keep title area visible

To keep the title area visible when clicking on the ribbon commands, modify #s4-titlerow in the css to:

#s4-titlerow { 
    display: block !important
}

Monday, October 17, 2011

SharePoint 2010 branding: left nav accordion, highlight location

Collapse/expandable left nav:
$(document).ready(function() {
 $("#s4-leftpanel-content ul.root>li.static").css("border-bottom","1px Solid #eaeaea");

 $("div.s4-ql div.menu-vertical > ul.root > li.static >a").each(function()
   {    
    // Does this have children UL elements
     if($(this).parent().children("ul").size() > 0){

   //initial load hide
   $(">ul", $(this).parent()).hide();
    $($(this).parent()).addClass("cssClosed");
  
    $("div.menu-vertical>ul.root>li.static>ul.static>li.selected").parent().css("display", "block");
    $("div.menu-vertical>ul.root>li.static>ul.static>li.selected").parent().parent().addClass("cssOpen");
  
    //add toggle
    $(this).toggle(function() {
    $(">ul", $(this).parent()).show("slow");
    $($(this).parent()).removeClass("cssClosed");
    $($(this).parent()).addClass("cssOpen");

     },
     function() {
    $(">ul", $(this).parent()).hide("slow");
    $($(this).parent()).removeClass("cssOpen");
    $($(this).parent()).addClass("cssClosed");
     }
   );
        
  }      
  });

});

The css:
.cssClosed {
 background:url('/_layouts/images/Menu-right.gif') no-repeat 160px 7px;
}
.cssOpen{
 background:url('/_layouts/images/Menu2.gif') no-repeat 150px 7px;
}

The result (closed):




The result (opened):


Result selected: