Category: Technology

MVC HTMLHelper Error

While starting with MVC one of the most basic error encountered is the one where using reference is missed for HTMLHelper class.

Below is the example of typical error.

System.Web.Mvc.HtmlHelper has no applicable method named ‘TextBox’ but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.

To resolve this error you need to make sure you have added the namespace reference for “System.Web.Mvc.Html” to your files.

Where all that name space reference should be:

1. Web.Config of your Area. “<add namespace=”System.Web.Mvc.Html” />”

2.  View Page. “<%@ Import Namespace=”System.Web.Mvc.Html” %>”

3. Controller. “using System.Web.Mvc.Html;”

 

Attribute *** is a String, but a Memo type was specified.

Another error of the Day:

“Attribute *** is a String, but a Memo type was specified.”

While importing solution we got given error. This error signifies that the data type of Attribute mentioned on the given entity has been changed and CRM does not permit that.

Only solution for this problem is to delete the attribute.

If this is in a production system then you are in for a whole lot of work as you will have keep the data in some other field/flat file mapped to the record and re-import data so that there is no data loss.

 

OptionSetId cannot be changed. EnumAttributeInfo.AttributeDescription.OptionSetId

In CRM 2011, While merging some customization we were getting error  that OptionSetId Can not be changed. 

OptionSetId cannot be changed. EnumAttributeInfo.AttributeDescription.OptionSetId(2806db8c-368a-42d5-8cdd-b3d3538580de) != ab8567b8-9e4e-e411-af60-080027314af2

 

  1. For Fixing error first we need to find the optionset that’s changed. (In SQL Server Management studio run “select name from optionsetview where optionsetid = ‘ab8567b8-9e4e-e411-af60-080027314af2” where highlighted part is second guid in error)
  2. Remove dependencies in CRM like field on form, views and then delete optionset field.
  3. Re-import solution.

This I had to do couple of times as there were multiple optionsets that were deleted and recreated.

Thanks to Becky Cote for the solution.

Import Unmanaged Solution error OptionSetId cannot be changed.

Windows could not start the iis admin service on local computer

While restarting IIS I was getting following error

“The IIS Admin Service or the World Wide Web Publishing Service, or a service dependent on them failed to start.  The service, or dependent services, may had an error during its startup or may be disabled.”

Went to services.msc and tries starting “IIS Admin Service” and got following error:

“windows could not start the iis admin service on local computer”

“Specified file could not be found”.

To resolve this I followed given msdn blog.

Steps:

1. Went to “C:WINDOWSsystem32inetsrv”, “MetaBase.xml” was missing

2. Went to History Folder “C:WINDOWSsystem32inetsrvHistory”.

3. Backed up the latest file and renamed it to “MetaBase.xml”.

4. Pasted file in “C:WINDOWSsystem32inetsrv”.

5. Went to Services.msc and started “IIS Admin Service” and it worked 🙂

 

HTML Web Resource in CRM

In Microsoft Dynamics CRM HTML web resource we have Xrm.Page.context parameter from where you can get different information about your CRM/Page etc…

image

This gives an impression that we will have access to all other XRM scripting properties like Xrm.Page.data etc… but that is not the case.

I was having requirement to get the record ID and found given msdn document. Which tells you can pass the records as parameters.

http://msdn.microsoft.com/en-in/library/gg309536.aspx#BKMK_PassingParametersToWebResources

How to Do It:

Go to Web resource Properties in form Editor, Select given check box.

image

You will be able to get the record id in URL.

Pre Check Box Checked

image

Post Check Box Checked (there is a whole lot of stuff as given in msdn)

image

Fetching Data from Query String GetQueryString(“id”) will give you the record id. Similarly you can fetch other values as well.

[code language=”javascript”]
function GetQueryString(key) {
var resourceUrl = document.location.href;
var queryList = resourceUrl.split(/[?&]+/);
for (i = 0; i < queryList.length; i++) {
pair = queryList[i].split("=");
if (pair[0] == key) {
return pair[1];
}
}
}
[/code]

System.IO.Packaging Namespace not found

While moving a part of code from a console application to a SSIS package we started getting compile time error System.IO.Packaging namespace not found.

This seemed like a very basic thing as System.IO namespace is found in System.dll but having System.dll as a part of solution increased the confusion.

A quick Bing returned that its a part of WindowsBase.dll, referring WindowsBase.dll solved the issue.

This a a good example of “Out of Sight, Out of Mind” as not requiring to refer WindowsBase.dll frequently made me forget that it even exists.

End Of Bad Looking Posts with “Windows Live Writer”

It’s been a while since I have been writing blogs and messing around with blogspot, wordpress, moving to a personal hosting and then switching the host as well as the domain name to a new one. I am no hardcore blogger and I post only when I am getting bored and I have got nothing else to do with life. But while going through posts on one such Day I realized that the blogs I have written look really bad (I know they are bad to read as well but the look and feel just kill the motivation to read).

 

Realization: Blogs look Bad so readers don’t read hence less torture for readers.

 

Reason: Atleast Make it look a bit better and Writing blog with Word doesn’t help you do proper formatting.

 

Solution: Use Windows Live Writer as it tells you how your blog will look like with real formatting and also helps you manage blog properly.

 

Problem: Couldn’t install Windows Live Writer. “Please try installing Windows Live programs again.”

 

Reason: Who Cares?

Workaround: Download “Windows Live Essentials” and install from there.

http://windows.microsoft.com/en-us/windows-live/essentials

 

** This might be the last bad looking Post. From now on you will have to read the posts I’ll be writing.

Editing Quick Create Ribbon

You cannot edit quick create ribbon in CRM 2013 like you can do with form, home and sub-grid ribbon. You can neither disable it in supported manner nor can you remove Activities from it. You can not even add OOB entities which don’t support Refresh UI.

 

 

You can remove other entities from it like case, competitor etc…

To remove entities open the solution, Navigate to entity and deselect “Allow Quick Create”

Likewise you can add custom entities or refresh ui supporting entiries to quick create.

Error while Integrating CRM 2013 – SharePoint Online

While trying to integrate CRM 2013 Onpremise and Sharepoint Online we were getting following error.

 

“Validation could not succeed because the List component could not be detected.

Check that the URL is valid and try again. Click the following URL to verify:”

While we had done everything right and as suggested on MSDN but getting the error was frustrating.

To resolve the error we tried to set the “Display Mixed content” in IE Security settings to “Prompt” (as suggested in one of the blogs)

Also we added https://*.sharepoint.com to trusted site.

When nothing worked we tried going to fiddler on client to see if any request was being sent to SharePoint server from client side and noticed that the request which went was proceeded with a federated login request. Taking the hint from there we logged in to SharePoint from IE (in another tab so that there is an active session) and tried again. It Worked J.

Windows Phone Emulator Crashing

While trying to run a Windows Phone 8 App on Windows 8.1, Visual Studio 2012 I was getting compatibility Error.

Resolution:

In order to resolve this issue, you will need to install the Microsoft Visual Studio 2012 Update 3 on your system. This will fix the issue.

You can download the Microsoft Visual Studio 2012 latest Update from Microsoft Download Center

 

More Error Details:

“This program has compatibility issues”

On clicking Run the program without getting help it gave error regarding Xde.exe

Xde.exe has stopped working.

 

Problem signature:

Problem Event Name:    CLR20r3

Problem Signature 01:    XDE.exe

Problem Signature 02:    8.0.9900.0

Problem Signature 03:    50627a5e

Problem Signature 04:    System.Management

Problem Signature 05:    4.0.30319.33440

Problem Signature 06:    520042ce

Problem Signature 07:    da

Problem Signature 08:    3f

Problem Signature 09:    System.Management.Management

OS Version:    6.3.9600.2.0.0.256.4

Locale ID:    16393   

Additional Information 1:    5861

Additional Information 2:    5861822e1919d7c014bbb064c64908b2

Additional Information 3:    01d7

Additional Information 4:    01d7340064827245f2249cd1f1a7c264

 

Read our privacy statement online:


http://go.microsoft.com/fwlink/?linkid=280262

 

If the online privacy statement is not available, please read our privacy statement offline:


C:WINDOWSsystem32en-USerofflps.txt

 

On looking at event viewer it showed error:

The application (Microsoft Windows Phone Emulator, from vendor Microsoft) has the following problem: Microsoft Windows Phone Emulator is incompatible with this version of Windows. For more information, contact Microsoft.