Tuesday, April 22, 2008

Failed to register ASP.NET client scripts on this site

I just tried to install an EPiServer 4.62 site on my new development machine, when I came across this error: "Failed to register ASP.NET client scripts on this site".

It turns out that this error message occurs when you have installed other .NET Frameworks (i.e. 3.0 and 3.5) where aspnet_regiis.exe does not exist. The fix for this is to temporarily move folder(s) from "C:\WINDOWS\Microsoft.NET\Framework\" and retry installation.

Friday, April 18, 2008

Formatting code segments in Blogger

I found this great post about adding custom style sheets to blogger. Check out this link if you want your code segments to look good.

Thursday, April 17, 2008

Programatically using the Business Data Catalog

Yesterday I had to convert an existing SharePoint WebPart from using Microsoft CRM webservices to use the MOSS Business Data Catalog (BDC) as the means of data connection.

I created the following class that may be of use to some people. It builds up a string dictionary of the entity you are searching for. For example if you need to find all the information about a particular organisation pass in the name of the entity "dboAccountBase", the field to search on "AccountID", and the Guid for the organisation. You will be returned a string dictionary containing all the fields for your particular organisation.

 
private Dictionary GetDictionary(string entityName, string filterKey, string filterValue)
{
Dictionary dict = new Dictionary();

Entity entity = BdcInstance.GetEntities()[entityName];
FilterCollection filters = entity.GetFinderFilters();
IEntityInstanceEnumerator enumerator = entity.FindFiltered(filters, BdcInstance);

while (enumerator.MoveNext())
{
IEntityInstance iEntity = enumerator.Current;
DataRow dr = iEntity.EntityAsDataTable.Rows[0];

if ((dr[filterKey] != null || dr[filterKey] != DBNull.Value)
&& (dr[filterKey].ToString().ToUpper() == filterValue.ToUpper()))
{
foreach (DataColumn dataColumn in dr.Table.Columns)
{
if (dr[dataColumn] == null || dr[dataColumn] == DBNull.Value)
{
dict[dataColumn.ColumnName] = string.Empty;
}
else
{
dict[dataColumn.ColumnName] = dr[dataColumn].ToString();
}
}
break;
}
}
return dict;
}




private LobSystemInstance _instance = null;


private LobSystemInstance BdcInstance
{
get
{
if (_instance == null)
{
NamedLobSystemInstanceDictionary sysInstances =
ApplicationRegistry.GetLobSystemInstances();

_instance = sysInstances[BdcInstanceName];
}
return _instance;
}
}

Welcome to my blog

Welcome to my blog, where I will be writing about my work, my life and other stuff.
Posts will include current projects and problems I am working on, with a particular focus on Microsoft Technologies; including SharePoint, WSS 3.0, and MOSS.
I will also keep everyone updated on my sporting exploits and any other things that I find interesting.
I hope you enjoy.