How to use onchange's event using c#
-
Tuesday, October 30, 2007 5:24 PM
Hi,
How to use onchange's event using c# for this apllication:
i want to let the date of birth's field calculate the person's age, I know that is possible make this using JavaScript, but it's needed to be done using c#.Thank
All Replies
-
Tuesday, October 30, 2007 8:33 PMModerator
Hi,
C# cannot be used on client side for the purpose of onChange event of any field of CRM form. Only JScript is supported. You may develop callouts which are deployed on server side of MS CRM and use C# .net to program callouts. In this case, you may use update callout.
-
Wednesday, October 31, 2007 12:04 PM
Hi,
Thank. Could you give me an example. I tried the code but has not
public override PreCalloutReturnValue PreCreate(CalloutUserContext userContext, CalloutEntityContext entityContext, ref string entityXml, ref string errorMessage)
{
PreCalloutReturnValue calloutRetVal = PreCalloutReturnValue.Continue;// error message is not set at the begining
errorMessage = string.Empty;XmlDocument xd = new XmlDocument();
xd.LoadXml(entityXml);/* all the elements in the XML file is iterated, and only desired ones are added to the nvPostedInfo collection */
NameValueCollection nvPostedInfo = new NameValueCollection();
NameValueCollection nvPostedTeste = new NameValueCollection();foreach (XmlElement element in xd.GetElementsByTagName("Property"))
{
string strAttributeName = element.Attributes.GetNamedItem("Name").Value;switch (strAttributeName)
{
case "address1_line3":
nvPostedInfo.Add("address1_line3", element.InnerText);
break;
case "address1_line2":
nvPostedTeste.Add("address1_line2", element.InnerText);
break;
}
}if (nvPostedInfo["address1_line3"] == "test")
{
nvPostedTeste["address1_line2"] = "test";
}
return calloutRetVal;
} -
Wednesday, October 31, 2007 4:22 PMModerator
The code you posted won't actually do much. In order to amke any sort of change to the values that will be updated by the record, you need to modify the entityXml passed in to the method. You need to add a new property for the new field to this Xml.
Take a look a the SDK for some samples, or check Michael's blog: http://www.stunnware.com/crm2/topic.aspx?id=Callout2
-
Wednesday, October 31, 2007 6:16 PMI am using Template Site http://blogs.msdn.com/arash/archive/2006/08/25/use-visual-studio-2005-to-build-crm-callouts.aspx therefore use the VS 2005 Framework 2.0, when the add the references webservice CrmService gives more 1000 errors. What can be?
-
Wednesday, October 31, 2007 6:19 PMModerator
VS 2005 generates a proxy that is not compatible with the 1.1 framework. You need to gen the proxy with VS 2003 then add that class manually.