Sunday, October 14, 2012

MVC 4 Bundling


Add to the  View\Web.config :



and the following inside View\....cshtml

@if (IsSectionDefined("scripts"))
       @RenderSection("scripts", required: false)

Still got errors, so  work around was needed as I had a demo and 2012 release was only in a week....



    @ViewBag.Title - Movie App

Master Detail View in MVC4/Razor is easy


@model MyDataFirst.Master
    ViewBag.Title = "Master";




                    @{ if (Model.Detail != null)
                           foreach (var item in Model.Detail)

Entity Framework connection string


change to


Installing the performance counter strings for service ASP.NET_64 (ASP.NET_64) failed

This is a doozy.  You will not be able to install SharePoint 2010, or change IIS features.  I tried reinstalling frameworks, fiddling in IIS etc.

In the event log you will get
Installing the performance counter strings for service ASP.NET_64 (ASP.NET_64) failed. The first DWORD in the Data section contains the error code.
Unable to install counter strings because the SYSTEM\CurrentControlSet\Services\ASP.NET_64\Performance key could not be opened or accessed. The first DWORD in the Data section contains the Win32 error code.

What I did was create a SYSTEM\CurrentControlSet\Services\ASP.NET_64\Performance key (only ASP.NET_64_2.0.50727 exists).
I completely uninstalled IIS and all components, restarted and then redid the IIS I needed to run SharePoint 2010 on my Windows7 machine,

The name ‘InitializeControl’ does not exist in the current context

You may just receive an error like so.
"The name ‘InitializeControl’ does not exist in the current context” – Visual Web Part (Sandboxed) bug and how to fix it

in Visual Studio in a SharePoint Visual Web Part 2012 in a Sandboxed solution.

My error was a "'" as in "'<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>"
instead of "<%@ "


Saturday, October 13, 2012

SharePoint Online viewstate maximum

Big problem, if the viewstate in a SharePoint Online webpart exceed 128KB it breaks with

Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.

Try setting controls to no use viewstate and making viewstate as small as possible.

How to setting values of InfoPath Textbox with jquery/javascript, json.

How to setting values of InfoPath Textbox with jquery/javascript, json.

Put this code in CEWP on a web part page containing an InfoPath Form Web Part.

Set delay, as InfoPath loads asynchronously, so document ready in jquery does not work.

window.onload = function()
    window.setTimeout(readyCall, 1000);

then get reference

  var textBoxEmployeeId = $("#ctl00_m_g_9053a19d_7ea2_49c3_9af1_11ab9e5bbca3_FormControl0_V1_I1_T2");
then call json endpoint

var url = "https://yourserver/endpoint?callback=?";
$.getJSON(url, null, function (data) {

then set focus.  This is VERY import in InfoPath, or else it will not presist or preserve the data


In InfoPath set the postback options of the field to NEVER

This way you can call json, or other web services, and write the values to InfoPath

How to hide the "Cannot be Blank" In InfoPath 2010, SharePoint Online

<style type="text/css">


Get all fields for XSLT webpart in SharePoint 2010

Place this in an xslt on the server, then link it in the dataview web part


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:x="" xmlns:d="" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="" xmlns:asp="" xmlns:__designer="" xmlns:xsl="" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal" xmlns:o="urn:schemas-microsoft-com:office:office">
<xsl:include href="/_layouts/xsl/main.xsl"/>
<xsl:include href="/_layouts/xsl/internal.xsl"/>
<xsl:template match="/">
   <textarea rows="20" cols="100">
<xsl:template match="node()|@*">
   <!-- Copy the current node -->
       <!-- Including any child nodes it has and any attributes -->
       <xsl:apply-templates select="node()|@*"/>