Debugging a Plug-in

Plugin is a .NET assembly that can be used to intercept events generated from the CRM system to perform a variety of actions. Some common plug-ins will perform a complicated update routine on CRM entities and\or attributes when it might be impractical to use Javascript or Workflow. Not like in most of the other developments, …

DateTime in C#

Convert DateTime to a string with a relevent format var usCultureInfo = new CultureInfo ("en-US", false); var date = new DateTime (2012, 3, 22, 15, 6, 0); date.ToString ("MM/dd/yy", usCultureInfo);

Binding a Dictionary to a Drop Down List

Binding data from a Dictionary is not so challenging as "Key" and "Value" pairs can be used for the drop down list properties. Following code samples show the results after assigning data source to the drop down list. Before Dictionary genderDictionary = new Dictionary(); genderDictionary.Add(1, "Male"); genderDictionary.Add(2, "Female"); genderDictionary.Add(3, "Transgender"); this.ddlGender.DataSource = genderDictionary; this.ddlGender.DataBind(); After …

Get the CRM server url from Silverlight [If the silverlight page is in a form]

private static String GetServerUrlFromCrmContext() { try { // If the Silverlight is in a form, this will get the server url ScriptObject xrm = (ScriptObject)HtmlPage.Window.GetProperty("Xrm"); if (xrm != null) { ScriptObject page = (ScriptObject)xrm.GetProperty("Page"); ScriptObject pageContext = (ScriptObject)page.GetProperty("context"); String serverUrl = (String)pageContext.Invoke("getServerUrl"); return serverUrl; } else { goto DevUrl; } } catch { goto DevUrl; …